JSON at line 1 column 3 [duplicate]

JSON at line 1 column 3 [duplicate] - Curling stone sliding on ice

Here's the command, formatted what I thoughtwas correctly...

/tellraw @p ["",{"text":"This map is based off of 1.9 features such as detecting when you pick up items,","color":"green"},{"text":" [HINT] ","color":"dark_green","bold":true,"clickEvent":{"action":"run_command","value":"/tellraw @p {{\"text\":\"[HINT]\",\"color\":\"dark_blue\"},{\"text\":\"This pickaxe cannot break lit glowstone lamps.\",\"color\":\"light_purple\"}}"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Click For Hint"}]}}},{"text":"so you may need to think outside of the box for some levels. good Luck!","color":"green"}]

However it's giving me Invalid json: malformed JSON at line 1 column 3 Please help!



Best Answer

Your clickEvent value starts with two curly brackets instead of a square followed by a curly.

However, when a player clicks a clickEvent via /tellraw, they are running the value as if they have manually typed it into the chat themselves. This means that the player is subject to chat limitations, such as requiring OP to run commands as well as a 100-character limit. The command being run exceeds that character limit, so it is trimmed (causing an error due to invalid format as a result of the trim).

The solution is to either use a shorter command or to use a different command altogether. For example, /scoreboard for OP'd players or /trigger for non-OP'd players while using an external mechanism to target players with a changed score.

Example using /scoreboard:

The /tellraw command becomes:

/tellraw @p ["",{"text":"This map is based off of 1.9 features such as detecting when you pick up items,","color":"green"},{"text":" [HINT] ","color":"dark_green","bold":true,"clickEvent":{"action":"run_command","value":"/scoreboard players set @a[c=1] OBJ 1"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Click For Hint"}]}}},{"text":"so you may need to think outside of the box for some levels. good Luck!","color":"green"}]

(clickEvent value specifically being):

/scoreboard players set @a[c=1] OBJ 1

External command sending a new /tellraw command to players with an OBJ score of 1:

/tellraw @a[score_OBJ_min=1] [{"text":"[HINT]","color":"dark_blue"},{"text":"This pickaxe cannot break lit glowstone lamps.","color":"light_purple"}]

Afterwards, set the player to have an OBJ score of 0 to prevent constant spam:

/scoreboard players set @a[score_OBJ_min=1] OBJ 0



Pictures about "JSON at line 1 column 3 [duplicate]"

JSON at line 1 column 3 [duplicate] - Illustration of woman analyzing financial line graphic
JSON at line 1 column 3 [duplicate] - Modern black automobile with glowing headlights and illumination in underground parking lot with marking lines and columns in evening time
JSON at line 1 column 3 [duplicate] - Crop unrecognizable female in ornamental sweater reading newspaper article while sitting in armchair in house room



Can JSON have duplicate values?

We can have duplicate keys in a JSON object, and it would still be valid. The validity of duplicate keys in JSON is an exception and not a rule, so this becomes a problem when it comes to actual implementations.

What is SyntaxError JSON parse unexpected character at line 1 column 1 of the JSON data?

The "SyntaxError: JSON. parse: unexpected character" error occurs when passing a value that is not a valid JSON string to the JSON. parse method, e.g. a native JavaScript object. To solve the error, make sure to only pass valid JSON strings to the JSON.

Can JSON have multiple keys?

No, you cannot. This is a limitation of JSON specification json.org You have to copy you values to each key from the array ["TypeA","TypeB","TypeC"] and store it separately.

Do JSON keys need to be unique?

Thanks. The JSON RFC says "the names within an object SHOULD be unique" so implementations will differ. You may find one that has more relaxed rules.



Render JSON File as Dropdown \u0026 Remove Duplicate Objects in React | Part 3




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: SHVETS production, Monstera, Erik Mclean, Kübra Arslaner