command to give enchanted items in minecraft code example

Example 1: how to give enchanted items

1.13+
/give @p diamond_sword{Enchantments:[{id:sharpness,lvl:5},{id:knockback,lvl:2},
{id:fire_aspect,lvl:2},{id:looting,lvl:3},{id:sweeping,lvl:3},
{id:unbreaking,lvl:3},{id:mending,lvl:1}]} 1

1.9+
/give @p diamond_sword 1 0 {ench:[{id:16,lvl:5},{id:19,lvl:2},{id:20,lvl:2},
{id:21,lvl:3},{id:34,lvl:3},{id:70,lvl:1}]}

pre 1.9
/give @p diamond_sword 1 0 {ench:[{id:16,lvl:5},{id:19,lvl:2},{id:20,lvl:2},
{id:21,lvl:3},{id:34,lvl:3}]}

Example 2: how to give enchanted armor

1.13+
/give @p (armour_piece){Enchantments:[{id:(name),lvl:(lvl_num)},
{id:(name),lvl:(lvl_num)},{id:(name),lvl:(lvl_num)},{id:(name),lvl:(lvl_num)},
{id:(name),lvl:(lvl_num)},{id:(name),lvl:(lvl_num)},{id:(name),lvl:1}]} 1

1.9+
/give @p (armour_piece) 1 0 {ench:[{id:(id_num),lvl:(lvl_num)},
{id:(id_num),lvl:(lvl_num)},{id:(id_num),lvl:(lvl_num)},
{id:(id_num),lvl:(lvl_num)},{id:(id_num),lvl:(lvl_num)},
{id:(id_num),lvl:(lvl_num)}]}

pre 1.9
/give @p (armour_piece) 1 0 {ench:[{id:(id_num),lvl:(lvl_num)},
{id:(id_num),lvl:(lvl_num)},{id:(id_num),lvl:(lvl_num)},
{id:(id_num),lvl:(lvl_num)},{id:(id_num),lvl:(lvl_num)}]}

Tags:

Misc Example