Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danthedaniel/f8e2ec8385a161c89578a65965e41426 to your computer and use it in GitHub Desktop.
Save danthedaniel/f8e2ec8385a161c89578a65965e41426 to your computer and use it in GitHub Desktop.
A comprehensive JSONSchema document describing the Minecraft text component JSON serialization format as of Minecraft 1.21
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"definitions": {
"Component": {
"type": "object",
"properties": {
"text": { "type": "string" },
"translate": { "type": "string" },
"with": {
"type": "array",
"items": {
"anyOf": [
{ "type": "number" },
{ "type": "string" },
{ "$ref": "#/definitions/Component" }
]
}
},
"extra": {
"type": "array",
"items": {
"anyOf": [
{ "type": "number" },
{ "type": "string" },
{ "$ref": "#/definitions/Component" }
]
}
},
"color": { "type": "string" },
"bold": { "type": "boolean" },
"italic": { "type": "boolean" },
"underlined": { "type": "boolean" },
"strikethrough": { "type": "boolean" },
"obfuscated": { "type": "boolean" },
"insertion": { "type": "string" },
"hoverEvent": { "$ref": "#/definitions/HoverEvent" },
"clickEvent": { "$ref": "#/definitions/ClickEvent" }
}
},
"HoverEvent": {
"anyOf": [
{ "$ref": "#/definitions/ShowTextHoverEvent" },
{ "$ref": "#/definitions/ShowItemHoverEvent" },
{ "$ref": "#/definitions/ShowEntityHoverEvent" }
]
},
"ShowTextHoverEvent": {
"type": "object",
"properties": {
"action": { "const": "show_text" },
"contents": {
"anyOf": [
{ "type": "number" },
{ "type": "string" },
{ "$ref": "#/definitions/Component" },
{
"type": "array",
"items": {
"anyOf": [
{ "type": "number" },
{ "type": "string" },
{ "$ref": "#/definitions/Component" }
]
}
}
]
},
"value": {
"anyOf": [
{ "type": "number" },
{ "type": "string" },
{ "$ref": "#/definitions/Component" },
{
"type": "array",
"items": {
"anyOf": [
{ "type": "number" },
{ "type": "string" },
{ "$ref": "#/definitions/Component" }
]
}
}
]
}
}
},
"ShowItemHoverEvent": {
"type": "object",
"properties": {
"action": { "const": "show_item" },
"contents": {
"type": "object",
"properties": {
"id": { "type": "string" },
"count": { "type": "number" },
"tag": { "type": "string" }
},
"required": ["id"]
},
"value": { "type": "string" }
}
},
"ShowEntityHoverEvent": {
"type": "object",
"properties": {
"action": { "const": "show_entity" },
"contents": {
"type": "object",
"properties": {
"type": { "type": "string" },
"id": {},
"name": {
"anyOf": [
{ "type": "string" },
{ "$ref": "#/definitions/Component" }
]
}
},
"required": ["type", "id"]
},
"value": { "type": "string" }
}
},
"ClickEvent": {
"type": "object",
"properties": {
"action": {
"enum": [
"open_url",
"open_file",
"run_command",
"suggest_command",
"change_page",
"copy_to_clipboard"
]
},
"value": { "type": "string" }
}
}
},
"$ref": "#/definitions/Component"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment