I've been at this for almost two hours and no one seems to have the same problem as I and I doubt this will be solved but I'll try anyway.

this is the code

/tellraw @p ["Would you like to teleport?",{"text":"Yes","color":"green","bold":"true","clickEvent":{"action":"run_command","value":"/tp @p ~ ~4 ~ "},"hoverEvent":{"action":"show_text","value":{"text":"Confirm"}},{"text":"No","color":"red","bold":"true","clickEvent":{"action":"run_command","value":"/tellraw @p{"text":"Come back when you want to teleport"}"}}}]

this part is fine

/tellraw @p ["Would you like to teleport?",{"text":"Yes","color":"green","bold":"true","clickEvent":{"action":"run_command","value":"/tp @p ~ ~4 ~ "},"hoverEvent":{"action":"show_text","value":{"text":"Confirm"}}

it's just when I add this

,{"text":"No","color":"red","bold":"true","clickEvent":{"action":"run_command","value":"/tellraw @p{"text":"Come back when you want to teleport"}"}}}]

Minecraft gives me the error:

Invalid JSON at line 1 column 203

I've tried to space it out and figure out what column 203 is but I can't, I don't know what I did. Anyone got any ideas?

  • Only tangentially related, but you probably don't want to do /tp in a tellraw; that only works if the user clicking has OP access – ppperry Aug 5 at 1:25
up vote 82 down vote accepted
+100

The 'JSON' (or 'Javascript Object Notation') is the part of the Minecraft command surrounded by square brackets. The square brackets represent an array, and all main objects (curly brackets) are part of that array.

If you haven't set up your array or objects in the right way, Minecraft will be unable to interpret what your command means. Luckily, there are some tools you can use to help you debug this.


The first thing to do in these situations is to format your JSON string to make it easier to read. JSONLint can be used for this. Paste in the part of your command starting from the square bracket, run the validator, and copy out the formatted JSON.

Secondly, you want to validate your JSON string. You can also use JSONLint to validate settings, but I find JSON Formatter & Validator a bit easier to use, as it keeps a history of changes so you can go back to a particular version if you need to.

Here is the breakdown of your JSON string and the errors JSON Formatter & Validator found:

JSON Formatter & Validation output

First thing I can see is that, in your ClickEvent's Value, it's highlighted the 'text' part because the double-quotes you're using here aren't being interpreted the way you want them to. In this case, you want them to be treated as 'text' to be used in your click event later, but at the moment the JSON interpreter thinks they are the 'end' of the JSON statement.

You need to add a backslash to escape your internal double quotes in order for them to be treated as text:

"value": "/tellraw @p{\"text\":\" Come back when you want to teleport \"}"
         ^           | ^     ^  ^                                      ^
          external   |  these ones are 'escaped' because they 
          quote mark |  are 'inside' the external quotes

Let's fix it and run it again:

Validation Output #2

Now there's only one error left. This is happening because the object above the highlighted bracket isn't properly closed with a matching close-bracket:

Missing bracket

The interpreter expects you to close the object before starting a new one:

 [
    "Would you like to teleport?", {
        "text": "Yes",
        "color": "green",
        "bold": "true",
        "clickEvent": {
            "action": "run_command",
            "value": "/tp @p ~ ~4 ~ "
        },
        "hoverEvent": {
            "action": "show_text",
            "value": {
                "text": "Confirm"
            }
        }}, 
         ^ add this

Running again, it seems that fixed the error at that object, but now there's an extra close-bracket at the bottom:

Expecting comma or close square bracket

"Expecting comma or ']'" means that it expects you to add another item (with comma) or end the array (with close-square-bracket). That close-curly-bracket makes no sense here.

Remove that extra curly bracket, and tada!

Valid JSON

Here's your valid JSON array (you can reduce it to a single line and add back the command stuff yourself). I give no guarantees that it will do what you want, but at least it is valid now.

["Would you like to teleport?", {
    "text": "Yes",
    "color": "green",
    "bold": "true",
    "clickEvent": {
        "action": "run_command",
        "value": "/tp @p ~ ~4 ~ "
    },
    "hoverEvent": {
        "action": "show_text",
        "value": {
            "text": "Confirm"
        }
    }
}, {
    "text": "No",
    "color": "red",
    "bold": "true",
    "clickEvent": {
        "action": "run_command",
        "value": "/tellraw @p{\"text\":\"Come back when you want to teleport\"}"
    }
}]
  • 4
    thank you so much for explaining that to me. and it works perfectly – ND99 Apr 4 '17 at 1:33
  • 2
    @ND99 - Glad to help. Hope this explanation helps you and others find and fix problems in the future as well :) – Robotnik Apr 4 '17 at 1:37

Firstly, the "line" and "columns" are basically referring to the characters in the text. Since all of your code (the command) is all on one line - it makes sense. The column however, is the individual "blocks" each character sits in. Eg.:

  | 0 | 1 | 2 | 3 | 4 |
1 | H | E | L | L | O |

As you can see, the word begins at 'line 1, column 0', and ends at 'line 1, column 4'. So in reference to your error, the 204th character (remember to start at 0!) is the character that is throwing out your command. Oddly enough, however, this error refers to the section of the command after the target (i.e. @p) - including the space.

  | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ...
1 |   | { | " | t | e | x | t | " | ...

NOTE: It might not be a character that already exists in your command, it could also be a character that is expected, but is not there.

  • ahh thank you for explaining that. this will certainly help me with future errors – ND99 Apr 6 '17 at 4:54

Use this: JSON Formatter. It's a web-based tool to view, edit, format, and validate JSON

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.