mojira.dev
MC-122397

title and tellraw inconsistent JSON parsing

The title command will parse this JSON as having a text attribute.

title @a {text: "Hello, World!"}

The tellraw command will NOT parse this JSON as having a text attribute. It will not throw any errors, it will just quietly fail to output text.

tellraw @a {text: "Hello, World!"}

Instead, this workaround is required:

tellraw @a {"text": "Hello, World!"}

Linked issues

Comments 4

You’re missing the title position argument, is it still inconsistent if that argument is added? (title, subtitle or actionbar)

Without the title position argument it just uses the default "title" position.

EDIT: At any rate, I feel like the title command is parsing this more like "normal" JSON, and it's the tellraw one that's being overly picky. Are there multiple inconsistent JSON parsers used on the backend?

EDIT 2: I looked it up and apparently requiring the key to have quotes around it is actually pretty standard. Huh. Well, either way, it would make more sense to use the same parse function for all JSON parsers.

Without the title position argument it just uses the default "title" position.

To be clear, it's not defaulting to "title" because you didn't specify it, it's defaulting to "title" because you specified the position as "{text:" (which is invalid, but instead of throwing an error, it falls back to the title position). The actual input you're giving the JSON parser is "Hello, World!"}. The trailing curly bracket may be odd, but the GSON library being used will ignore any trailing characters once the valid JSON structure has been parsed.

As far as the issue with no errors from an invalid position, that has been fixed in 17w45a with the new command parser.

(Found original report at MC-114721)

Nicholas Lamicela

(Unassigned)

Unconfirmed

command, json, tellraw, title

Minecraft 1.12.2

Minecraft 17w45b

Retrieved