mojira.dev
MC-59504

Text in tellraw doesn't accept \ while text on signs/in books needs \ (JSON) = Tellraw wont work with signs

I am sorry if this is a duplicate, but formatting whit JSON became lot complicated and I recognized that:

  • Tellraw (doesn't accept \ ):

    /tellraw @p {text:"HI"}
  • Signs (needs \ ):

    /give @p sign 1 0 {BlockEntityTag:{Text1:"{\"text\":\"\",\"extra\":[{\"text\":\"CLICK\"}]}",id:"Sign"}}
  • Mixed (doesn't work, which makes pretty much sense):

    /give @p sign 1 0 {BlockEntityTag:{Text1:"{\"text\":\"\",\"extra\":[{\"text\":\"CLICK\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @p {text:\\\"Hi\\\"}\"}}]}",id:"Sign"}}

    (I made this using: http://ezekielelin.com/tellraw/#addExtraModalData )

This will cause the game having problems with text detection which will cause the game to put the whole command on the sign. Without the \ it wont recognize the text in the /tellraw as text and will give (in a command block) as ouput:

[13:28:53] Kann NBT-Daten Unexpected token 'H' at: Hi"}\"}}]}",id:"Sign" nicht analysieren

Linked issues

Comments 5

To avoid the escaping of nested quotes you can replace the inner set with single quotes:

/give @p sign 1 0 {BlockEntityTag:{Text1:"{'text':'','extra':[{'text':'CLICK'}]}",id:"Sign"}}

This

/tellraw @p {text:'HI'}

will work of course too.

That way this issue is a non issue.

This is the way it works right now. The fact that it's a not easy does not make it a bug. This a feature request.

I have one question, many things or bugs, seem pretty easy to fix by just copying and pasting!?

I guess I am wrong now, but couldn't you use nearly the exact code for tellraw also for signs, where is the diference?

The backslash is an escape character. Normally, " would signal the start or end of a string, so in order to have it inside a string, it must be escaped with \". In a sign, the JSON is already stored inside an NBT text tag, represented as a string in the give command, meaning the quotation marks inside it must be escaped.

Thank you, finally you get a answer here 😉

marcono1234

michael

Unconfirmed

book, json, sign, tellraw, text, written-book

Minecraft 14w26c

Retrieved