Why can't I paste § into a Minecraft command?

Solution 1:

You can actually set a color with the color-tag inside of the Name-tag by using a command like this:

/give @p diamond_sword{display:{Name:"{\"text\":\"Sword\",\"color\":\"dark_blue\"}"}}

Solution 2:

1.15 Update

Entering JSON text is now easier in 1.15 because NBT string tags can use single quotes '.

Instead of:

/give @s dirt{display:{Name:"[{\"text\":\"Earth\", \"color\":\"green\"}]"}}

Try:

/give @s dirt{display:{Name:'[{"text":"Earth","color":"green"}]'}}