How can I add more than one list-style property to an item?

This command gives me a diamond pickaxe with a single enchantment at maximum level:

give @p diamond_axe{Enchantments:[{id:"minecraft:unbreaking",lvl:255s}]} 1

Similarly, this command gives a potion that effects the consumer with Speed I for 30 seconds:

give @p minecraft:potion{CustomPotionEffects:[{Id:1, Amplifier:0, Duration:600}]}

I would like to apply multiple of these list-style properties on my item. How can I do so?


Solution 1:

To add one more list-style item property to an item, just put a comma , after the first compound dictating the property, and another compound with the next one.

Here is an example with the diamond axe and multiple enchantments:

Enchantments: [
  {id: "minecraft:sharpness", lvl: 255s},
  {id: "minecraft:efficiency", lvl: 255s},
  {id: "minecraft:unbreaking", lvl: 255s}
]

And here is an example with the potion and multiple custom potion effects:

CustomPotionEffects: [
  {Id: 1b, Amplifier: 0b, Duration: 600},
  {Id: 3b, Amplifier: 1b, Duration: 600},
  {Id: 5b, Amplifier: 2b, Duration: 600}
]

Be careful not to put a comma after the last compound in the list!