I tried to run a command like this:

/blockdata 1 2 3 {Command:"summon minecraft:area_effect_cloud ~ ~ ~ {Tags:["sg"]}"}

And then it replied it was expecting } but got s at ...Tags:["s<---HERE

By the way I am making music having a rondeau theme using command blocks, and I don't want to build the theme multiple times. I was wondering if it could be solved by just changing the command in the end of the frase once it was repeated in order to trigger the next frase.

Is it possible to execute such command?


"Escaping" is the official term for what you want.

To put a quotation mark (") into a string, you use this: \"
To put a backslash (\) into a string, you use this: \\

So this means that a string in a string in a string looks like this*:

"first string \"second string \\\"third string\\\" second string\" first string"

Minecraft also allows you to use ' as the outer and " as the inner string limiter, that way you don't need to escape anything on that second level (a string in a string) and you only need a single backslash for the third level (a string in a string in a string).

(*This can get crazily long, for example I once made a one-command creation in a complicated way that also placed signs. Some of the quotation marks needed to be escaped with fifteen backslashes.)

| improve this answer | |
  • 2
    +1 for “fifteen backslashes” – L. F. Aug 19 '19 at 10:03
  • It might have also been 31, I'm not sure. But to find it, I would have to download about 50GB of old Google Drive archives, I don't really want to do that. :D – Fabian Röling Aug 19 '19 at 13:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.