mojira.dev
MC-157558

Trouble with scores within JSON text

What I'm trying to do: use the

/data merge block

command to set a sign's text to say "Population of" on the first line, "Felidale" on the second line, and then a number from a player's scoreboard on the third line. 

To do this, I've been working off of this example command: 

/data merge block 20 65 -2012 {Text1:"[\"\"]",Text2:"[\"\",{\"text\":\"You found \",\"color\":\"dark_aqua\"},{\"score\":{\"name\":\"@p\",\"objective\":\"easterEgg\"},\"color\":\"gold\"},{\"text\":\"/9\",\"color\":\"gold\"}]",Text3:"[\"\",{\"text\":\"Easter Eggs!\",\"color\":\"dark_aqua\"}]"}

This looks like the first attachment.

My issue: I can't seem to move the score parameters to the next line. When I do so, it simply says "invalid escape sequence". For example, here's the malformed code I used: 

/data merge block 20 65 -2012 {Text1:"[\"\",{\"text\":\"Population of \",\"color\":\"black\"}]",Text2:"[\"\",{\"text\":\"Felidale\",\"color\":\"black\"}]",Text3:"[\"\",{\"score\":{\"name\":\"fakePlayerName\",\"objective\":\"c_count_total\"},\"color\":\"black\"}]"

What am I doing wrong...?

Attachments

Comments 1

You are missing a } at the end in the command.
Correct command would be:

/data merge block 20 65 -2012 {Text1:"[\"\",{\"text\":\"Population of \",\"color\":\"black\"}]",Text2:"[\"\",{\"text\":\"Felidale\",\"color\":\"black\"}]",Text3:"[\"\",{\"score\":{\"name\":\"fakePlayerName\",\"objective\":\"c_count_total\"},\"color\":\"black\"}]"}

Honor Kerley

(Unassigned)

Unconfirmed

(Unassigned)

1.14.4

Retrieved