Why are my quotation marks causing an “unexpected token” error with this command?

Why are my quotation marks causing an “unexpected token” error with this command? - Expressive angry businessman in formal suit looking at camera and screaming with madness while hitting desk with fist

I need help with a specific command that I am using in a new game that I am creating inside of Minecraft. The command I have so far is:

/give @p sign 1 0 {BlockEntityTag:{Text1:"{"text":"
[MF2]","color":"gold","clickEvent":
{"action":"run_command","value":"tellraw @a ["",{"text":"[MF2] 
","color":"gold"},{"selector":"@p","color":"dark_aqua"},{"text":" is now an
admin of the server!","color":"white"}]"}}",Text3:"{"text":"Click to join
Admin","color":"dark_aqua","clickEvent":
{"action":"run_command","value":"scoreboard teams join admin @p"}}"},display:
{Name:"Custom Sign"}}

If I take out the /tellraw command, the command works fine, but I need the inner command to announce to the game that a new admin has joined.

With /tellraw inside, the error message reads:

Data tag parsing failed: Unexpected token t at:

text":"[MF2]","color":"gold","clickEvent":{"action":"run_command","value":"tellraw
  @a [""{"text":"[MF2] ","color":"gold"},
  {"selector":"@p","color":"dark_aqua"},{"text":" is now an admin 
  of the server!","color":"white"}]"}}",Text3:"{"text":"Click to join
  Admin","color":"dark_aqua","clickEvent":
  {"action":"run_command","value":"scoreboard teams join admin @p"}}"

If anyone knows how to fix this, please let me know.


Related:



Best Answer

An updated solution that adds on to this other solution.

In 1.14 and above, you can reduce the need for escape characters by surrounding your whole string with single quotes ' instead of double quotes ". This means that you can freely include "s in your string without escaping them with \s. However, this means that you will need to escape every ' in your string.

Example:

/give @s dirt{display:{Name:'[{"text":"Hello, World!"}]'}}

Note that single and double quoted strings with the same text are considered equivalent. However, Minecraft now uses single-quoted strings for all strings containing JSON text components. This is evident because using /data get always shows JSON text components as single-quoted strings, no matter which format was used to type them out.




Pictures about "Why are my quotation marks causing an “unexpected token” error with this command?"

Why are my quotation marks causing an “unexpected token” error with this command? - 1 + 1 = 3 Text on Black Chalkboard
Why are my quotation marks causing an “unexpected token” error with this command? - Red and Blue Pelikan Br 40 Eraser on White Surface
Why are my quotation marks causing an “unexpected token” error with this command? - Close-Up Shot of Keyboard Buttons



How do you fix quotation marks?

How to Change the Existing Quotation Mark Style
  • Press the Ctrl+H shortcut key to open the Find and Replace dialog box.
  • Enter " in both the Find what and Replace with boxes.
  • Select Replace All to convert all quotation marks in the document to your preferred style.


  • How do I fix double quotes and apostrophes in Windows 10?

    How to Fix Double Press Apostrophe and Quotes in Windows 10
  • Press the Windows Key.
  • Go to settings.
  • Go to time & language.
  • Go down to region & language.
  • Click on English United Kingdom (May be different on other machines) and click on the options button.


  • What do quotation marks mean in code?

    8243), and as HTML entities ′ and ″. Double quotation marks are also often used to represent the ditto mark. Straight single and double quotation marks are used in most programming languages to delimit strings or literal characters.

    How do you escape quotation marks?

    Alternatively, you can use a backslash \\ to escape the quotation marks.



    How to Use Quotation Marks | Grammar Lessons




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

    Images: Andrea Piacquadio, George Becker, Pixabay, Miguel Á. Padriñán