how to give a player an enchanted item in minecraft code example

Example: 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