Minecraft:JSON: Difference between revisions
More actions
Remove broken links to missing pages |
Sync: updated from Minecraft Tag: Manual revert |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
'''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''. | '''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: | In ''Minecraft'', JSON format is used to store the following data: | ||
* Text in the {{cmd|tellraw}} and {{cmd|titleraw}} commands, [[Minecraft:book]]s, [[Minecraft:sign]]s, item names, entity names, world names, scoreboard displays, and text that is displayed through script | * [[Minecraft:Text]] in the {{cmd|tellraw}} and {{cmd|titleraw}} commands, [[Minecraft:book]]s, [[Minecraft:sign]]s, item names, entity names, world names, [[Minecraft:scoreboard]] displays, and text that is displayed through [[Minecraft:script API]]s in {{BE}}. | ||
* The <code>pack.mcmeta</code> file that describes a {{el|je}} resource pack and data pack. | * The <code>[[Minecraft:pack.mcmeta]]</code> file that describes a {{el|je}} [[Minecraft:resource pack]] and [[Minecraft:data pack]]. | ||
* The <code>[[Minecraft:manifest.json]]</code> file that describes a {{el|be}} [[Minecraft:add-on]]. | * The <code>[[Minecraft:manifest.json]]</code> file that describes a {{el|be}} [[Minecraft:add-on]]. | ||
* Files in a resource pack that define | * Files in a [[Minecraft:resource pack]] that define [[Minecraft:model]]s, [[Minecraft:colormap]]s, [[Minecraft:sounds.json|sound events]], [[Minecraft:Resource pack#Texts|text]]s, [[Minecraft:font]]s, [[Minecraft:Resource pack#GUI|GUI]], etc. | ||
* Files in a data pack that define advancements, loot | * Files in a [[Minecraft:data pack]] that define [[Minecraft:advancements]], [[Minecraft:loot table]]s, [[Minecraft:tags]], [[Minecraft:recipes]], [[Minecraft:Custom dimension|dimensions]], [[Minecraft:Custom dimension|dimension types]] and [[Minecraft:predicates]].{{only|java}} | ||
* Files in a [[Minecraft:behavior pack]] that define [https://docs.microsoft.com/en-us/minecraft/creator/reference/content/entityreference/ entity behaviors], [https://docs.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/ block behaviors], item behaviors, etc.{{only|bedrock}} | * Files in a [[Minecraft:behavior pack]] that define [https://docs.microsoft.com/en-us/minecraft/creator/reference/content/entityreference/ entity behaviors], [https://docs.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/ block behaviors], item behaviors, etc.{{only|bedrock}} | ||
* Files in a [[Minecraft:skin pack]] that identify the skins being used.{{only|bedrock}} | * Files in a [[Minecraft:skin pack]] that identify the skins being used.{{only|bedrock}} | ||
* Advancements and statistics (as <code>.minecraft/saves/*/data/stats/*.json</code>) | * [[Minecraft:Advancements]] and [[Minecraft:statistics]] (as <code>.minecraft/saves/*/data/stats/*.json</code>) | ||
* The profile data for the launcher (as launcher_profiles.json) | * The profile data for the [[Minecraft:launcher]] (as [[Minecraft:launcher_profiles.json]]) | ||
* Information about downloaded | * Information about downloaded [[Minecraft:version]]s (as [[Minecraft:version.json]]) | ||
* Inside the {{w|Base64}} encoded textures data of player | * Inside the {{w|Base64}} encoded textures data of [[Minecraft:player head]]s and players.{{only|java}} | ||
== Syntax == | == Syntax == | ||
| Line 51: | Line 51: | ||
==== Array ==== | ==== Array ==== | ||
{{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. | {{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 [[Minecraft:NBT format|NBT]], values in a JSON array can use different data types. | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
| Line 72: | Line 72: | ||
== See also == | == See also == | ||
* JSON on Wikipedia | * [[Minecraft:w:JSON|JSON on Wikipedia]] | ||
== Navigation == | == Navigation == | ||
{{Navbox Java Edition technical|general}} | {{Navbox Java Edition technical|general}} | ||
| Line 82: | Line 80: | ||
[[Category:Development]] | [[Category:Development]] | ||
de:JSON | [[Minecraft:de:JSON]] | ||
es:JSON | [[Minecraft:es:JSON]] | ||
fr:JSON | [[Minecraft:fr:JSON]] | ||
ja:JSON | [[Minecraft:ja:JSON]] | ||
lzh:JSON | [[Minecraft:lzh:JSON]] | ||
pt:JSON | [[Minecraft:pt:JSON]] | ||
ru:Команды консоли | [[Minecraft:ru:Команды консоли#JSON-текст]] | ||
th:JSON | [[Minecraft:th:JSON]] | ||
uk:JSON | [[Minecraft:uk:JSON]] | ||
zh:JSON | [[Minecraft:zh:JSON]] | ||
Latest revision as of 11:08, 1 June 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.
Occurrences
In Minecraft, JSON format is used to store the following data:
- Minecraft:Text in the Template:Cmd and Template:Cmd commands, Minecraft:books, Minecraft:signs, item names, entity names, world names, Minecraft:scoreboard displays, and text that is displayed through Minecraft:script APIs in Template:BE.
- The
Minecraft:pack.mcmetafile that describes a Template:El Minecraft:resource pack and Minecraft:data pack. - The
Minecraft:manifest.jsonfile that describes a Template:El Minecraft:add-on. - Files in a Minecraft:resource pack that define Minecraft:models, Minecraft:colormaps, sound events, texts, Minecraft:fonts, GUI, etc.
- Files in a Minecraft:data pack that define Minecraft:advancements, Minecraft:loot tables, Minecraft:tags, Minecraft:recipes, dimensions, dimension types and Minecraft: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
- Minecraft:Advancements and Minecraft:statistics (as
.minecraft/saves/*/data/stats/*.json) - The profile data for the Minecraft:launcher (as Minecraft:launcher_profiles.json)
- Information about downloaded Minecraft:versions (as Minecraft:version.json)
- Inside the Template:W encoded textures data of Minecraft: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 Template:W 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 (\).
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.
- Template:Cd
- Template:Cd
- Template:Cd (=3×106)
Object
An Template:W, 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
Template:Ws 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 Template:W can be either true or false.
<syntaxhighlight lang="json" line="1"> {
"Steve": {
"isAlive": true
},
"Alex": {
"isAlive": false
}
} </syntaxhighlight>
See also
Template:Navbox Java Edition technical Template:Navbox Bedrock Edition
Minecraft:de:JSON Minecraft:es:JSON Minecraft:fr:JSON Minecraft:ja:JSON Minecraft:lzh:JSON Minecraft:pt:JSON Minecraft:ru:Команды консоли#JSON-текст Minecraft:th:JSON Minecraft:uk:JSON Minecraft:zh:JSON