Minecraft:JSON: Difference between revisions
More actions
Remove broken links to missing pages |
Fix template calls: add MC/ prefix |
||
| Line 4: | Line 4: | ||
In ''Minecraft'', JSON format is used to store the following data: | In ''Minecraft'', JSON format is used to store the following data: | ||
* Text in the {{ | * Text in the {{MC/Cmd|tellraw}} and {{MC/Cmd|titleraw}} commands, [[Minecraft:book]]s, [[Minecraft:sign]]s, item names, entity names, world names, scoreboard displays, and text that is displayed through script APIs in {{MC/BE}}. | ||
* The <code>pack.mcmeta</code> file that describes a {{ | * The <code>pack.mcmeta</code> file that describes a {{MC/El|je}} resource pack and data pack. | ||
* The <code>[[Minecraft:manifest.json]]</code> file that describes a {{ | * The <code>[[Minecraft:manifest.json]]</code> file that describes a {{MC/El|be}} [[Minecraft:add-on]]. | ||
* Files in a resource pack that define models, colormaps, [[Minecraft:sounds.json|sound events]], texts, fonts, GUI, etc. | * Files in a resource pack that define models, colormaps, [[Minecraft:sounds.json|sound events]], texts, fonts, GUI, etc. | ||
* Files in a data pack that define advancements, loot tables, tags, recipes, dimensions, dimension types and predicates.{{only|java}} | * Files in a data pack that define advancements, loot tables, tags, recipes, dimensions, dimension types and predicates.{{only|java}} | ||
| Line 14: | Line 14: | ||
* The profile data for the launcher (as launcher_profiles.json) | * The profile data for the launcher (as launcher_profiles.json) | ||
* Information about downloaded versions (as version.json) | * Information about downloaded versions (as version.json) | ||
* Inside the {{ | * Inside the {{MC/W|Base64}} encoded textures data of player heads and players.{{only|java}} | ||
== Syntax == | == Syntax == | ||
| Line 21: | Line 21: | ||
==== String ==== | ==== String ==== | ||
A {{ | A {{MC/W|String (computer science)|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 (<code>\</code>). | ||
* {{ | * {{MC/Cd|"foo"}} | ||
* {{ | * {{MC/Cd|"Hello, world"}} | ||
* {{ | * {{MC/Cd|"An escaped \" quote within a string"}} | ||
==== Number ==== | ==== 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 <code>e</code>. | A number is defined by entering in any number. Numbers can be non-whole, as indicated with a period, and can use exponents with <code>e</code>. | ||
* {{ | * {{MC/Cd|2}} | ||
* {{ | * {{MC/Cd|-0.5}} | ||
* {{ | * {{MC/Cd|3e6}} (=3×10<sup>6</sup>) | ||
==== Object ==== | ==== Object ==== | ||
An {{ | An {{MC/W|Object (computer science)|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). | ||
<syntaxhighlight lang="json" line="1"> | <syntaxhighlight lang="json" line="1"> | ||
| Line 51: | Line 51: | ||
==== Array ==== | ==== Array ==== | ||
{{ | {{MC/W|Array (data type)|Array}}s 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. | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
| Line 58: | Line 58: | ||
==== Boolean ==== | ==== Boolean ==== | ||
A {{ | A {{MC/W|Boolean data type|boolean}} can be either <code>true</code> or <code>false</code>. | ||
<syntaxhighlight lang="json" line="1"> | <syntaxhighlight lang="json" line="1"> | ||
| Line 75: | Line 75: | ||
==References== | ==References== | ||
{{Reflist}} | {{MC/Reflist}} | ||
== Navigation == | == Navigation == | ||
{{Navbox Java Edition technical|general}} | {{MC/Navbox Java Edition technical|general}} | ||
{{Navbox Bedrock Edition}} | {{MC/Navbox Bedrock Edition}} | ||
[[Category:Development]] | [[Category:Development]] | ||
Latest revision as of 20:30, 9 April 2026
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.
Occurences
In Minecraft, JSON format is used to store the following data:
- Text in the
- REDIRECT Template:Command
Template:Redr and
- REDIRECT Template:Command
Template:Redr commands, Minecraft:books, Minecraft: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
- REDIRECT Template:Edition
Template:Rcat resource pack and data pack.
- The
Minecraft:manifest.jsonfile that describes a
- REDIRECT Template:Edition
Template:Rcat Minecraft: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.Template:Only
- Files in a Minecraft:behavior pack that define entity behaviors, block behaviors, item behaviors, etc.Template:Only
- Files in a Minecraft:skin pack that identify the skins being used.Template: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
- REDIRECT Template:Wikipedia
Template:Redr encoded textures data of player heads and players.Template: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
- REDIRECT Template:Wikipedia
Template:Redr 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 (\).
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
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.
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr (=3×106)
Object
An
- REDIRECT Template:Wikipedia
Template:Redr, 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).
<syntaxhighlight lang="json" line="1"> {
"Bob": {
"ID": 1234,
"lastName": "Ramsay"
},
"Alice": {
"ID": 2345,
"lastName": "Berg"
}
} </syntaxhighlight>
Array
- REDIRECT Template:Wikipedia
Template:Redrs 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.
<syntaxhighlight lang="json"> ["Bob", "Alice", "Carlos", "Eve"] </syntaxhighlight>
Boolean
A
- REDIRECT Template:Wikipedia
Template:Redr can be either true or false.
<syntaxhighlight lang="json" line="1"> {
"Steve": {
"isAlive": true
},
"Alex": {
"isAlive": false
}
} </syntaxhighlight>
See also
- JSON on Wikipedia
References
<references group="">
</references>
| Editions |
| ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Development |
| ||||||||
| Technical |
| ||||||||
| Multiplayer | |||||||||
| Exclusive features |
| ||||||||
| Removed |
de:JSON es:JSON fr:JSON ja:JSON lzh:JSON pt:JSON ru:Команды консоли th:JSON uk:JSON zh:JSON