The json validator for realms is too strict and doesn't allow nbt fields within strings.
These forms of loot tables will work in single player and on servers, but realms will refuse to load them:
{
"type": "minecraft:loot",
"pools":
[{
"rolls": 1,
"entries": [{
"type": "minecraft:item",
"name": "minecraft:written_book",
"functions": [{
"function": "minecraft:set_nbt",
"tag": "{
title:\"Book title\",
author:\"Some name\",
pages:[
\'\"text\"\'
]
}"
}]
}]
}]
}
{
"type": "minecraft:loot",
"pools":
[{
"rolls": 1,
"entries": [{
"type": "minecraft:item",
"name": "minecraft:written_book",
"functions": [{
"function": "minecraft:set_nbt",
"tag": "{ title:\"Book title\", author:\"Some name\", pages:[ \'\"text\"\' ] }"
}]
}]
}]
}
Comments 2
Thank you for your report!
Minecraft Realms for Java Edition has received a lot of updates and fixes over the last two years, so this issue has probably already been fixed in the meantime (e.g. because it was a temporary outage or an issue with the base game).
Since this bug report has not been updated since at least two years, please let us know if this is still an issue in current versions of Minecraft and update the bug report if applicable. If this is no longer an issue, please let us know as well. Thanks!
This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki – 📖 FAQs
It's true that Realms is more strict than the game, but according to the ECMA-404 spec, newlines, carriage returns, and tab characters are illegal within JSON strings:
In fact, even in JavaScript, which is much less strict than JSON, those characters are not allowed (per ECMA-262):
Finally, single quotation marks have no importance in JSON syntax, so they should not be used in JSON to mark strings (incl. the nested JSON inside the tag definition).
These example lines:
... should become:
or you might as well compress it, since it's hardly readable anyway:
I agree there is a bug here in that the parse & validation are inconsistent, but I don't necessarily agree that Realms is wrong.
Here is a JavaScript snippet I tested in Chrome that should convert your loot table(s) to be compliant with Realms and then will copy it to your clipboard:
(Replace the
loot
object literal with the contents of your loot table file.)