*Update* apparently data tag is not JSON (why use your own almost-json implementation? You could use lenient gson).
Valid JSON does not work with the /summon command.
Keys are not accepted unless they are un-quoted.Escaping does not work (except for double-quotes)
Not working:
/summon Sheep ~ ~ ~ {"CustomName":"foobar"}
(This works now)
Not working:
/summon Sheep ~ ~ ~ {"CustomName":"foobar\\"}
It will take the first backslash as-is and then escape the double-quote, which of course causes an "Unbalanced quotation"
My two examples are 100% valid JSON, see: (they are, but apparently data tags aren't JSON)
Comments 14
I know how it works, but my examples are valid JSON so it should work, right?
And what's with my second example?
According to the Wiki:
The format is JSON, although it is not strict (lenient).
So it's a special kind of JSON. That's all I know.
LOL i just wrote that article on the wiki 😉
It's not a special kind. It's jst not strict. Valid JSON should still work, as it does for /tellraw
Typically, when I use /summon or /give, I use the following syntax:
/summon [mobname] ~ ~ ~ {display:{Name:"Whateverthenameis"}}
This typically works, and the mob summons with the name "Whateverthenameis"
Try that syntax.
Is this still a concern in the current Minecraft version 14w11b / Launcher version 1.3.11 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.
Updated this because I was wrong about data tags using JSON. I'll check if it's fixed, later.
Is this still a concern in the current Minecraft version 14w19a / Launcher version 1.3.11 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.
Tested in 14w20a. The first part of the bug seems to be fixed, the latter is still failing due to an "unbalanced quotation"
For the Minecraft developers: AFAIK you are already using Google gson elsewhere, so why not simply parse dataTags in 'lenient' mode? It parses both valid json and a lot of invalid json. It would parse the current format of dataTags additional to valid json while solving this (and other?) bugs. I actually thought you were using this already, but it seems like that is not the case.
The lenient gson documentation shows a list of problems it solves.
There shouldn't be any quotes around "CustomName"
Try:
This is how the command works.