mojira.dev
MC-93094

Strict JSON does not work for most NBT data.

This issue is related to MC-83460
In the issue above it is clearly said that with 1.9 lenient JSON will be gone. Honestly, I hate this change a lot (welcome to backslash hell), but however so far only JSON texts (like in /tellraw or /title or a bok or a sign) can be written in strict JSON.
If JSON has to be written in a strict JSON format in future versions, I want to do this as soon as possible.
If I try the following command, it will not work, although it is strict JSON.

/give @a minecraft:sign 1 0 {"display":{"Name":"JSON"}}

However, it does work like this:

/give @a minecraft:sign 1 0 {display:{Name:"JSON"}}}

or even without any quotes:

/give @a minecraft:sign 1 0 {display:{Name:JSON}}

When I however want to do a /tellraw I need to do strict JSON (as inttended).

/tellraw @a {"text":"I like blue","color":"blue"}

If I want to add this text in JSON format into my book, I need to mix different JSON parsing.

/give @a minecraft:sign 1 0 
{
	display:
	{
		Name:"JSON"
	},
	BlockEntityTag:
	{
		Text1:
		"{
			\"text\":\"I like blue\",
			\"color\":\"blue\"
		}"
	}
}

It becomes even more weird when I now add a clickEvent which gives me a book called JSON that has some JSON-text in it. See:

/give @a minecraft:sign 1 0 
{
	display:
	{
		Name:JSON
	},
	BlockEntityTag:
	{
		Text1:
		"{
			\"text\":\"Wanna have a\",
			\"color\":\"blue\",
			\"clickEvent\":
			{
				\"action\":\"run_command\",
				\"value\":
				\"
					/give @p minecraft:written_book 1 0 
					{
						title:JSON,
						author:me,
						pages:
						[
							\\\"
								{
									\\\\\\\"text\\\\\\\":\\\\\\\"Welcome to the backslash-hell (\\\\\\\\\\\\)\\\\\\\",
									\\\\\\\"color\\\\\\\":\\\\\\\"dark_red\\\\\\\"
								}
							\\\"
						]
					}
				\"
			}
		}",
		Text2:
		"{
			\"text\":\"book?\",
			\"color\":\"blue\"
		}"
	}
}

In the middle of it I have to use for the book's NBT again lenient JSON. An I am not able to use quotes there. This is inconsistent.

I would prefer it much if you could lenient JSON again (seriously look at the amount of backslashes!). But Mojang must have big reasons top change it. But it's a bug that you can't use strict JSON everywhere.
I hope minecraft will move to slash heaven soon again. But let's make it consistent at first. Otherwise the change simply makes no sense at all.

Linked issues

Comments 4

mrpingouin1

NBT syntax is not JSON or lenient JSON syntax.
JSON syntax only apply to the /title and /tellraw commands, and the following NBT tag : pages, Text1, Text2, Text3, Text4. Only these things don't support lenient JSON anymore.
The NBT syntax did not changed.

NeunEinser

Yo write NBTalso as JSON. So it should be the same in my mind.
And it is still a bug, that strict JSON does not work and you HAVE TO write lenient JSON.

Erik Broes

@unknown explained it very well already.

The syntax you complain about is not JSON, it just sortof smells like.

NeunEinser

okay, so JSON-texts get not converted into NBT. That's interesting. So thanks, @unknown for answering here.

NeunEinser

(Unassigned)

Unconfirmed

Minecraft 15w47c

Retrieved