JSON From Zero
Learn the JSON syntax DAI uses, how to read nested definitions, and how to fix the most common syntax failures.
JSON is structured data, not mysterious code.
DAI uses JSON to describe things: actions, entities, items, experiences, UI, rules and more. JSON does not “run” by itself; DAI or Minecraft reads it and interprets the fields.
The six pieces you need first
| Syntax | Name | Meaning |
|---|---|---|
{ } | Object | A group of named fields. |
[ ] | Array | An ordered list of values. |
"text" | String | Text, including IDs and names. |
42 | Number | Numeric value; no quotes. |
true / false | Boolean | On/off or yes/no value; no quotes. |
: and , | Separators | Colon joins a key to its value; comma separates entries. |
Read this one field at a time
{
"type": "sequence",
"sequence": [
{
"type": "run_command",
"action": "say Hello from my DAI pack"
}
]
}- The outer
{ }contains one DAI definition. "type": "sequence"says the definition contains ordered actions."sequence": [ ]is a list.- The inner
{ }is one action in that list. run_commandtells DAI which action primitive to use.
Commas: the most common first error
Valid
{
"name": "Example",
"enabled": true,
"cost": 5
}Invalid trailing/missing comma
{
"name": "Example"
"enabled": true,
"cost": 5,
}Strings must use double quotes
Standard JSON uses double quotes. 'single quotes' are not valid JSON strings. Do not add comments such as // note inside ordinary JSON unless a specific loader explicitly supports them.
IDs are usually strings
"my_game:hello" is a string containing a namespaced ID. Treat IDs like permanent addresses: change display text freely, but avoid changing stable IDs after release.
How to edit safely
- Start from a known-good example.Copy the closest documented definition.
- Change one field.Do not rewrite ten things before testing.
- Validate JSON.DAI Creator validation or a code editor can catch syntax before Minecraft reloads.
- Reload and test.Syntax-valid JSON can still contain wrong IDs or unsupported values.
Error translation
| Message family | What to inspect first |
|---|---|
| Expected comma / delimiter | Two entries are touching or a comma is misplaced. |
| Unexpected end of input | A closing } or ] is probably missing. |
| Expected property name | A key may be unquoted, malformed, or preceded by an extra comma. |
| Unknown action/type | The JSON parsed, but DAI does not know the requested ID/type. |
| Missing reference | The file points to another ID/path that does not exist. |
Checkpoint
You are ready when you can identify an object, array, string and boolean and can fix a missing comma without guessing.