JSON
Minecraft Wiki article. Categories: Java_Edition_technical, Bedrock_Edition, Development
This article is reproduced from JSON on the Minecraft Wiki. Mirrored from revision 3604358. It is licensed CC BY-NC-SA 3.0 by the Minecraft Wiki contributors — not under the Codex’s CC BY-SA 4.0, and it may not be used commercially. Edits belong upstream, not here.
JavaScript Object Notation (JSON) is a lightweight data-interchange format. It consists of key-value pairs and arrays values, and is used for storing and transmitting data in Minecraft.
Occurrences
In Minecraft, JSON format is used to store the following data:
- Text in the
/tellrawand/titlerawcommands, books, signs, item names, entity names, world names, scoreboard displays, and text that is displayed through script APIs in Bedrock Edition. - The
pack.mcmetafile that describes a Java Edition resource pack and data pack. - The
manifest.jsonfile that describes a Bedrock Edition add-on. - Files in a resource pack that define models, colormaps, sound events, texts, fonts, GUI, etc.
- Files in a data pack that define advancements, loot tables, tags, recipes, dimensions, dimension types and predicates.[Java Edition only]
- Files in a behavior pack that define entity behaviors, block behaviors, item behaviors, etc.[Bedrock Edition only]
- Files in a skin pack that identify the skins being used.[Bedrock Edition only]
- Advancements and statistics (as
.minecraft/saves/*/data/stats/*.json) - The profile data for the launcher (as launcher_profiles.json)
- Information about downloaded versions (as version.json)
- Inside the Base64 encoded textures data of player heads and players.[Java Edition only]
Syntax
Data types
A JSON file must contain a single JSON value, which can use any of the following five data types: string, number, object, array, and boolean. JSON files can be contained in a single line, however it is often useful to use indentation and line breaks to make a long JSON file more readable.
String
A string is delimited by quotes and can contain any combination of characters. Some special characters need to be escaped; this is done with a back slash (\).
"foo""Hello, world""An escaped \" quote within a string"
Number
A number is defined by entering in any number. Numbers can be non-whole, as indicated with a period, and can use exponents with e.
2-0.53e6(=3×106)
Object
An object, also referred to as a compound, is delimited by opening and closing curly brackets and contains key/value pairs. Pairs are separated with commas, keys and associated values are separated with colons. Each contained key needs to have a name that is unique within the object. A value can be of any data type as well (including another object).
{
"Bob": {
"ID": 1234,
"lastName": "Ramsay"
},
"Alice": {
"ID": 2345,
"lastName": "Berg"
}
}
Array
Arrays are delimited by opening and closing square brackets and can contain values of any data type, separated by commas. Unlike lists in NBT, values in a JSON array can use different data types.
["Bob", "Alice", "Carlos", "Eve"]
Boolean
A boolean can be either true or false.
{
"Steve": {
"isAlive": true
},
"Alex": {
"isAlive": false
}
}
See also
Navigation
Sources
- JSON — Minecraft Wiki, CC BY-NC-SA 3.0, revision 3604358.