How do I fix 'Invalid JSON' errors?
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?
Best Answer
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.
Pictures about "How do I fix 'Invalid JSON' errors?"
Quick Answer about "How do I fix 'Invalid JSON' errors?"
What does JSON invalid mean?
Usually used when non-well-formed content (content that does not conform to JSON syntax as per specification) is encountered. For further details see the "Raw Error Message" and the additional messages\u201d Error: \u201cInvalid UTF-8 start byte\u201d Error: \u201cAn error occurred indicating a json parsing problem.How do I fix JSON format?
JSON Syntax RulesHow do you fix updating failed the response is not a valid JSON response?
The most common solution for publishing or updating failed the response is not a valid JSON response error is to update your permalink structure. From your WordPress dashboard, go to Settings and then Permalinks. Then you can click on the Save Changes button to re-save or update the current permalink structure.More answers regarding how do I fix 'Invalid JSON' errors?
Answer 2
Use this: JSON Formatter. It's a web-based tool to view, edit, format, and validate JSON
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Ksenia Chernaya, Ksenia Chernaya, Ksenia Chernaya, Ksenia Chernaya