mojira.dev
MC-85368

JSON in books is not working

I tried to use:

/give @p written_book 1 0 {pages:["{text:\"Hi\"}"]}

I also tried:

/give @p written_book 1 0 {pages:["[{text:\"Hi\"}]"]}

The book it gives me says Invalid book tag.

This really sucks, because we've been having JSON related issues since 15w31a, and I really want it to work for a thing I'm working on for 1.9.

Comments 3

They changed JSON-text.
This works anymore:

"[{text:\"Hi\"}]"

You have to put each argument ("text", "color"...) in quotes (backward compatible to 1.8):

/give @p written_book 1 0 {title:"A",author:Somebody,pages:["{\"text\":\"Hi\"}"]}

(And u have to define author and title too)

You do not need to put quotes in the JSON, Mojang set it to lenient, which means keys don't require quotes. I found the solution as per your last advice, you do need all 3 (author, title, and pages) for the book to work.

So the following,
/give @p written_book 1 0 {HideFlags:32,title:"Book",author:"Author",pages:["{text:\"Hi\"}"]}
will work.

Moderators, feel free to close this. I apologize for this. It is true though, that the JSON generator no longer works, however. So Mojang must have changed their book parser without mention in the changelog.

/give @p written_book 1 0 {title:"Title",author:"Author",pages:["{\"text\": \"Hello World\"}"]}

Mike Dueck

Erik Broes

Unconfirmed

Minecraft 15w32c

Retrieved