Why won't this command work? [duplicate]
Solution 1:
If you remove the text from the NBT tag, you get this:
{{[{{},{}}
This shows that you have unbalanced brackets. To correct this, just add ]}}
to the command, to close all the brackets.
/summon Villager ~ ~2 ~ {Offers:{Recipes:[{buy:{id:371,Count:15},sell:{id:264,Count:4}}]}}
In future, you could use MCStacker, a tool for generating longer commands.
Solution 2:
Yes, your command is not work because some curly bracket is missing. Let me break down your code and you can see what is wrong on your code.
Here is the breakdown for your code, as you can see there is a lot curly bracket is missing.
Let me show you the correct code. So below this picture is the correct code you need to be.
If I change it into one line it will become like this:
/summon Villager ~ ~2 ~{Offers:{Recipes:[{buy:{id:371,Count:15},sell:{id:264,Count:4}}]}}
Hope this answer can make your problem clear.