mojira.dev
MC-37661

dataTag parsing/escaping issue

*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

Neospector

There shouldn't be any quotes around "CustomName"
Try:

/summon Sheep ~ ~ ~ {CustomName:"Foobar"}

This is how the command works.

deleted

I know how it works, but my examples are valid JSON so it should work, right?
And what's with my second example?

Neospector

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.

deleted

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

Evo Fearnley

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.

4 more comments
Deleted account

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.

deleted

Updated this because I was wrong about data tags using JSON. I'll check if it's fixed, later.

Deleted account

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.

deleted

Tested in 14w20a. The first part of the bug seems to be fixed, the latter is still failing due to an "unbalanced quotation"

deleted

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.

deleted

Jens Bergensten

Unconfirmed

command, json, server

Minecraft 1.7.1, Minecraft 1.7.2, Minecraft 13w47e, Minecraft 13w48a, Minecraft 13w48b, Minecraft 1.7.9, Minecraft 14w20b, Minecraft 14w21a, Minecraft 14w21b

Minecraft 14w31a

Retrieved