Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:JSON: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Sync: updated from Minecraft
Tag: Manual revert
SyncBot (talk | contribs)
Sync: updated from Minecraft
 
(3 intermediate revisions by the same user not shown)
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:


* [[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}}.
* [[Minecraft:Text component format|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>[[Minecraft:pack.mcmeta]]</code> file that describes a {{el|je}} [[Minecraft:resource pack]] and [[Minecraft: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]].
Line 18: Line 18:
== Syntax ==
== Syntax ==
=== Data types ===
=== 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.
A JSON file must contain a single JSON value, which can use any of the following five data types: string, number, object, array, boolean, and null. 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 ====
==== String ====
Line 67: Line 67:
     "Alex": {
     "Alex": {
         "isAlive": false
         "isAlive": false
    }
}
</syntaxhighlight>'''Null'''.
Null is used to represent an unknown value.<syntaxhighlight lang="json" line="1">
{
    "player1": {
        "isdead": false
    },
    "player2": {
        "isdead": null
     }
     }
}
}

Latest revision as of 11:08, 2 October 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:

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, boolean, and null. 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.

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>Null.

Null is used to represent an unknown value.<syntaxhighlight lang="json" line="1"> {

   "player1": {
       "isdead": false
   },
   "player2": {
       "isdead": null
   }

} </syntaxhighlight>

See also

Navigation

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