TL;DR: Minecraft has the ability to syntax highlight NBT, and StackOverflow has the ability to highlight JSON, so why can't we?

On StackOverflow, there is the ability to add syntax highlighting to your code blocks like so:

void doSomething() {
    System.out.println("Hello, World!");

This has only be added to StackOverflow right now, but I would like to ask whether we can add it to Arqade.

At first glance, you may think that adding code syntax highlighting is not really needed, since questions that include code are probably going to get closed as off-topic for the game development reason.

But there are two file formats that frequently appear on Arqade and are not closed as off-topic: NBT and JSON.

In many posts where I help users with NBT, I sometimes expand NBT to show the syntax tree more clearly, like so:

Wrong way:

    Name: [
            text:"This is a test"

Right way:

    Name:'[{"text":"This is a test"}]'

When you type NBT in your posts, syntax is very important! One mistyped character and you run the risk of having invalid NBT data.

It would be much easier to notice and display corrected or malformed NBT if it was syntax-highlighted. In fact, Minecraft already highlights NBT for us:


My feature request is that for any NBT or JSON detected in commands, automatically syntax-highlight it. For example:

This would be helpful in situations like this, where JSON and NBT are combined. Without syntax highlighting, it isn't immediately obvious that the inners of the Name tag are a string.

But with syntax highlighting:

Now it is clearly obvious that the JSON text inside is actually a string, clearing up the fog on why it looks weird.

I think that whenever a question has on it, we should automatically detect and syntax highlight NBT.

This will probably a challenge because NBT is not an official language and will need to be manually programmed in, but I think that we'll be able to do it if we put our mind into it!

  • 1
    I think some amount of coloring for commands in general (depending of course on the version of the game) would be cool also, although that would be less necessary as there isn’t nesting and more chances for errors like in NBT parameters
    – Penguin
    Nov 30, 2020 at 5:31
  • How close is NBT to JSON syntax? i.e. could SE devs give us 99% supported highlighting by simply enabling the syntax highlighter they use elsewhere, and turning on JSON highlighting?
    – Robotnik Mod
    Dec 24, 2020 at 1:43
  • @Robotnik I've now answered below with NBT syntax guide.
    – One 2 Many
    Dec 24, 2020 at 19:06

1 Answer 1


NBT syntax

The following is a guide to NBT syntax, to help whoever implements this. If you don't want to listen to me rambling on about NBT, here is a simple image displaying everything about how NBT is highlighted:


Basic syntax

The NBT file format consists of key-value pairs, similar to JSON. However, differences include he



Keys that consist only of characters in the above line are entered directly, without any punctuation before or after. The whitespace character is not part of the above line:


Keys can be surrounded in apostrophes ' or quotation marks " if they contain characters not in the above line or if they contain spaces:bet you didn't know that you can surround keys in quotes

{"Key with 'apostrophes' and \"quotation marks\"":"My value"}
{'Key with \'apostrophes\' and "quotation marks"':"My value"}

Minecraft's preference is to remove quotation marks from keys if possible. If not possible, Minecraft will use the mark " to surround a key unless the first character of '" to appear in the key is ", in which case it will surround the key with '.

Minecraft will highlight the key in aqua (#55FFFF), but not the quotation marks surrounding it.


Strings follow a similar format to keys. They can be entered without marks around them if they consist only of the same set of characters above.

{MyKey:"value with \"quotation marks\" and 'apostrophes'"}
{MyKey:'value with \'apostrophes\' and "quotation marks"'}

Minecraft's preferences for strings is different. It will always add surrounding marks to strings that do not have them, and it will always use " as the surrounding mark unless the first of these characters '" to appear in the string is ", in which case the surrounding mark will be '.

Minecraft will highlight the string in green (#55FF55), but not the quotation marks surrounding it.


Numbers are entered with a single letter immediately following their entry, the first letter of their data type name. The exception is Integer, which is entered without a letter and assumed to be data type if not specified. The letter can be uppercase or lowercase, but Minecraft will convert those letters to the casing shown below depending on the letter. The maximum values for the integral data types are shown below:


Numbers that are outside the range of the specified data type or contain leading zeros are turned into strings and should be highlighted like strings, with the exception of a decimal number missing its data type (1.2), in which case it will become a double value (1.2d).

Minecraft will highlight the number itself in gold (#FFAA00) and the letter representing the data type in red (#FF5555), unless the number is invalid, in which case it will be turned into a string, surrounded in quotes "", and highlighted green.

Compounds and Lists

Lists are in brackets [] and contain a list of items. Each item in the list must be of the same data type. Minecraft looks at the first item in the list to determine what type of list it is.


ValidList: ["NBT","is","awesome!"]
InvalidList:[1,2b,"mixed data types"]

Compounds are in braces {} and is just recursively an NBT file within itself.


Do not mix up arrays with lists. Arrays are better for storing a nonvariable number of items. Arrays are available for bytes, integers, and longs, but not shorts.



The letter before the semicolon defines the array type.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .