Mojira Archive
MC-270949

Single quotes cannot be used in lore component of text components

The lore of items has always used single and double quotation marks.
Use the following command to obtain a stick with lore:

/give @s stick[minecraft:lore=[' "text" ']] 1

But in "hoverEvent" of text components, in "show_item", the lore component can only use two layers of double quotes, and cannot use single quotes to wrap double quotes, otherwise it will get a malformed JSON error.

Use the following command to tellraw text carrying hoverEvent to all players, which can display a grass block with lore:

/tellraw @a [{"text":"[ITEM]","hoverEvent":{"action":"show_item","contents":{"id":"minecraft:grass_block","count":32,"components":{"minecraft:lore":[" \"text\" "]}}}}]

It works because we used two layers of double quotes.

But the following command will result in an error:

/tellraw @a [{"text":"[ITEM]","hoverEvent":{"action":"show_item","contents":{"id":"minecraft:grass_block","count":32,"components":{"minecraft:lore":[' "text" ']}}}}]

Invalid

Mini_Ye

2024-04-20, 05:35 AM

2024-04-20, 06:02 PM

2024-04-20, 06:02 PM

0

2

Unconfirmed

(Unassigned)

1.20.5 Release Candidate 2

-