Raw JSON text format

The raw JSON text is a way to add modifications to text that is displayed or triggered.

Structure
The raw JSON text uses strict JSON syntax.

Java Edition
The format of raw JSON text is a JSON string, a  JSON array, or a  JSON object that supports the following (mostly optional) elements:
 * A string representing raw text to display directly in chat. Same as having only a tag in the  base object.
 * Same as having all elements except the first in this array appended to the end of the array of the first chat component in this array. Each element repeats this raw JSON text structure.
 * The base chat component object.
 * : A string representing raw text to display directly in chat. Note that selectors such as "@a" and "@p" are not translated into player names; use selector instead. Can use escape characters, such as for newline (enter),  for tab, etc.
 * : The translation identifier of text to be displayed using the player's selected language. This identifier is the same as the identifiers found in lang files from assets or resource packs. Ignored when exist in the root object.
 * : A list of chat component arguments and/or string arguments to be used by . Useless otherwise.
 * The arguments are text corresponding to the arguments used by the translation string in the current language, in order (for example, the first list element corresponds to "%1$s" in a translation string). Argument structure repeats this raw JSON text structure.
 * : A player's score in an objective. Displays nothing if the player is not tracked in the given objective. Ignored when any of the previous fields exist in the root object.
 * : The name of the player whose score should be displayed. Selectors (such as @p) can be used, in addition to "fake" player names created by the scoreboard system. In addition, if the name is "*", it shows the reader's own score (for example,  shows every online player their own score in the "obj" objective).
 * : The internal name of the objective to display the player's score in.
 * : Optional. If present, this value is used regardless of what the score would have been.
 * : A string containing a selector (@p,@a,@r,@e or @s) and, optionally, selector arguments. Unlike text, the selector is translated into the correct player/entity names. If more than one player/entity is detected by the selector, it is displayed in a form such as 'Name1 and Name2' or 'Name1, Name2, Name3, and Name4'. Ignored when any of the previous fields exist in the root object. Clicking a player's name inserted into a /tellraw command this way suggests a command to whisper to that player. Shift-clicking a player's name inserts that name into chat. Shift-clicking a non-player entity's name inserts its UUID into chat.
 * : A string that can be used to display the key needed to preform a certain action. An example is  which always displays "E" unless the player has set a different key for opening their inventory. Ignored when any of the previous fields exist in the root object.
 * : A string indicating the NBT path used for looking up NBT values from an entity, a block entity or a command storage. Ignored when any of the previous fields exist in the root object.
 * : A boolean to indicate whether the game should interpret the SNBT value at the path indicated by as a raw JSON text (according to this raw JSON text structure). Useless otherwise.
 * : A string specifying the coordinates of the block entity from which the NBT value is obtained. The coordinates can be absolute or relative. Useless if is absent.
 * : A string specifying the target selector for the entity from which the NBT value is obtained. Useless if is absent.
 * : A string specifying the namespaced ID of the command storage from which the NBT value is obtained. Useless if is absent.
 * : The color to render this text in. Valid values are "black", "dark_blue", "dark_green", "dark_aqua", "dark_red", "dark_purple", "gold", "gray", "dark_gray", "blue", "green", "aqua", "red", "light_purple", "yellow", "white", and "reset" (cancels out the effects of colors used by parent objects). Technically, "bold", "italic", "underlined", "strikethrough", and "obfuscated" are also accepted, but it may be better practice to use the tags below for such formats.
 * : Boolean (true/false) - whether to render text in bold. Defaults to false.
 * : Boolean (true/false) - whether to render text in italics. Defaults to false.
 * : Boolean (true/false) - whether to render text underlined. Defaults to false.
 * : Boolean (true/false) - whether to render text with a strikethrough. Defaults to false.
 * : Boolean (true/false) - whether to render text obfuscated. Defaults to false.
 * : When the text is shift-clicked by a player, this string is inserted in their chat input. It does not overwrite any existing text the player was writing.
 * : Allows for events to occur when the player clicks on text.
 * : The action to perform when clicked. Valid values are "open_url" (opens value as a URL in the player's default web browser), "open_file" (opens the value file on the user's computer), "run_command" (has value entered in chat as though the player typed it themselves. This can be used to run commands, provided the player has the required permissions), "change_page" (can be used only in written books) changes to page value if that page exists, "suggest_command" (similar to "run_command" but it cannot be used in a written book, the text appears only in the player's chat input and it is not automatically entered. Unlike insertion, this replaces the existing contents of the chat input), and "copy_to_clipboard" (copy the value to the clipboard). "open_file" is used in messages automatically generated by the game (e.g. on taking a screenshot) and cannot be used in commands or signs.
 * : The URL, file, chat, command or book page used by the specified action. Note that commands must be prefixed with the usual "/" slash.
 * : Allows for a tooltip to be displayed when the player hovers their mouse over text.
 * : The type of tooltip to show. Valid values are "show_text" (shows raw JSON text), "show_item" (shows the tooltip of an item that can have NBT tags), and "show_entity" (shows an entity's name, possibly its type, and its UUID).
 * : The formatting of this tag varies depending on the action. Note that "show_text" is the only action to support an Object as the value; all other action values are Strings and should thus be wrapped in quotes.
 * "show_text" can be either a raw string of text or an object with the same formatting as this base object. Note that clickEvent and hoverEvent do not function within the tooltip, but the formatting and extra tags still work.
 * "show_item" can be a string formatted like item NBT data. Contains the "id" tag, and optionally the "Damage" tag and "tag" tag (which is the same compound used as "dataTag" in the command).
 * "show_entity" can be string formatted like a compound with the string values "type" (such as "Zombie"), "name", and "id" (should be an entity UUID, but can actually be any string).
 * : A list of additional objects, sharing the same format as the base object.
 * A list element whose structure repeats this raw JSON text structure. Note that all properties of this object are inherited by children except for text, extra, translate, with, and score. This means that children retain the same formatting and events as this object unless they explicitly override them.

Due to the extra tag, the above format may be recursively nested to produce very complex and functional text strings. However, a raw json text doesn't have to be complicated at all: virtually all properties are optional and may be left out.

To be valid, each object must have at least either text, translate, score, selector, keybind or nbt (everything else is optional). As a matter of shorthand, however, the entire Object may be substituted with a String. In this case, that string is considered the value of the text property. For example,  is equivalent to. This shorthand substitution is valid anywhere a raw text object is required (including the base  argument of, the elements of the extra list, and the value of a "show_text" hover_event).

Bedrock Edition
Unlike in Java Edition, The raw JSON text in Bedrock Edition is more strict and simple.
 * The root tag.
 * : A list contains all text object.
 * The base chat component object.
 * : A string representing raw text to display directly in chat. Note that selectors such as "@a" and "@p" are not translated into player names; "\n" is newline (enter). Ignored when exist in the object.
 * : The translation identifier of text to be displayed using the player's selected language. This identifier is the same as the identifiers found in lang files from assets or resource packs.
 * : A list of string arguments to be used by . Useless otherwise.
 * The arguments are text corresponding to the arguments used by the translation string in the current language, in order (for example, the first list element corresponds to "%%1" in a translation string).

Interpreting
The structure will interpret and displayed as a text. The text, format or trigger conditioned from the chat components. Some components will be ignored due to the component or the way to display text.

also accepts an array of objects and/or strings; they are concatenated. It also accepts a tree of nested arrays; they are traversed depth-first. For example:

/tellraw @a ["Hello there, ",{"selector":"@p"},"."] /tellraw @a [["The "],[["quick ","brown "],[{"selector":"@p"}," jumps "],"over "],"the "],["lazy ","dog."]

Scores and target selectors are evaluated for a Sign when it is placed or edited and for a Written Book when it is "resolved" (opened for the first time after signing). They won't update after that, and they won't work if edited onto an existing sign with an NBT editor, or onto a book that's already marked resolved. There's no way to wrap text onto the next line of a sign or the next page of a book during resolution; instead, the extra text simply disappears.