Bedrock Edition raw JSON text format

Raw JSON text is a way to add modifications to text that is displayed – this can be color, commands to run when clicked, or even displaying localized text based on the locale of the user.

In Bedrock Edition, raw JSON text will be supported in chat with, in titles with , in book texts (except title and author), and on signs.

Raw text format
The format of raw JSON text in Bedrock Edition is a JSON Object which supports the following (mostly optional) elements:
 * 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). The string entered for text will not be displayed if translate is specified.
 * : 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 chat component arguments and/or string arguments to be used by translate.
 * 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).


 * Basic raw text example:

This will send a message to all players saying "Hello World". However this will only be in English, see the Translate action to see how to send localized texts.

Appending
Raw text takes in an array of text objects. Each object in the list will be added to the previous object. For example, outputs the same "Hello World" as the first example. Appending text can be useful to combine 2 different localized texts, or apply different colors to each word etc.

Translate
The translate object allows creators to provide localized text to users. If translate is specified along with text, translate will override the text object. The string to provide to translate is the name of the string in the language files. For example in Vanilla Minecraft "commands.op.success" is the string that displays when /op is used on a player successfully.

This will output "Opped %s" to all players. Note that because of text being ignored with translate specified, the following example will output the same text:

With
In the translate example above, it outputs "Opped %s". To have a name or other text show up instead of %s "with" needs to be specified as well. Note that "with" only works with "translate" and also requires an array instead of curly brackets.

%%s
"translate" and "%s" can be used without needing a corresponding string in the localization files. For example:

This outputs "Hello Steve" to all players.

Multiple %s
%%s can be used multiple.times. They will be filled in, in the order specified

Outputs: "Hello Steve and Alex"

Ordering with %%#
The order to fill in %s to be filled in can be changed by instead specifying it with %%#, replacing # with an actual number. For example to swap the position of Steve and Alex in the above example, instead run the following:

Outputs: "Hello Alex and Steve"

Category:Official documentation