You have to put the command in a command block because it's too long:
summon villager ~ ~1 ~ {VillagerData:{level:5,profession:farmer,type:plains},Offers:{Recipes:[{maxUses:10,buy:{id:emerald,Count:10b},sell:{id:chest,Count:1b,tag:{display:{Name:'"Iron Rank"'},BlockEntityTag:{Items:[{Slot:0,id:iron_helmet,Count:1b,tag:{Enchantments:[{id:protection,lvl:4},{id:respiration,lvl:3},{id:aqua_affinity,lvl:1},{id:thorns,lvl:3},{id:unbreaking,lvl:3},{id:mending,lvl:1}]}},{Slot:1,id:iron_chestplate,Count:1b,tag:{Enchantments:[{id:protection,lvl:4},{id:thorns,lvl:3},{id:unbreaking,lvl:3},{id:mending,lvl:1}]}},{Slot:2,id:iron_leggings,Count:1b,tag:{Enchantments:[{id:protection,lvl:4},{id:thorns,lvl:3},{id:unbreaking,lvl:3},{id:mending,lvl:1}]}},{Slot:3,id:iron_boots,Count:1b,tag:{Enchantments:[{id:protection,lvl:4},{id:feather_falling,lvl:3},{id:thorns,lvl:3},{id:depth_strider,lvl:3},{id:unbreaking,lvl:3},{id:mending,lvl:1}]}},{Slot:4,id:iron_sword,Count:1b,tag:{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}]}},{Slot:5,id:iron_pickaxe,Count:1b,tag:{Enchantments:[{id:efficiency,lvl:5},{id:unbreaking,lvl:3},{id:fortune,lvl:3},{id:mending,lvl:1}]}},{Slot:6,id:iron_pickaxe,Count:1b,tag:{Enchantments:[{id:efficiency,lvl:5},{id:silk_touch,lvl:1},{id:unbreaking,lvl:3},{id:mending,lvl:1}]}},{Slot:7,id:iron_axe,Count:1b,tag:{Enchantments:[{id:sharpness,lvl:5},{id:efficiency,lvl:5},{id:unbreaking,lvl:3},{id:fortune,lvl:3},{id:mending,lvl:1}]}},{Slot:8,id:iron_shovel,Count:1b,tag:{Enchantments:[{id:efficiency,lvl:5},{id:unbreaking,lvl:3},{id:fortune,lvl:3},{id:mending,lvl:1}]}},{Slot:9,id:iron_shovel,Count:1b,tag:{Enchantments:[{id:efficiency,lvl:5},{id:silk_touch,lvl:1},{id:unbreaking,lvl:3},{id:mending,lvl:1}]}},{Slot:10,id:iron_hoe,Count:1b,tag:{Enchantments:[{id:unbreaking,lvl:3},{id:mending,lvl:1}]}}]}}}}]}}
I set the price to 10 emeralds and the max uses to 10, which you can change. This command will summon a plains farmer level 5 villager but you can change the VillagerData
to whatever you want (see the wiki for more information).
Formatted NBT:
{
VillagerData: {
level: 5,
profession: farmer,
type: plains
},
Offers: {
Recipes: [{
maxUses: 10,
buy: {id: emerald, Count: 10b},
sell: {
id: chest,
Count: 1b,
tag: {
display: {Name: '"Iron Rank"'},
BlockEntityTag: {
Items: [
{
Slot: 0,
id: iron_helmet,
Count: 1b,
tag: {
Enchantments: [
{id: protection, lvl: 4},
{id: respiration, lvl: 3},
{id: aqua_affinity,lvl: 1},
{id: thorns,lvl: 3},
{id: unbreaking,lvl: 3},
{id: mending,lvl: 1}
]
}
},
{
Slot: 1,
id: iron_chestplate,
Count: 1b,
tag: {
Enchantments: [
{id: protection, lvl: 4},
{id: thorns, lvl: 3},
{id: unbreaking, lvl: 3},
{id: mending, lvl: 1}
]
}
},
{
Slot: 2,
id: iron_leggings,
Count: 1b,
tag: {
Enchantments: [
{id: protection, lvl: 4},
{id: thorns, lvl: 3},
{id: unbreaking, lvl: 3},
{id: mending, lvl: 1}
]
}
},
{
Slot: 3,
id: iron_boots,
Count: 1b,
tag: {
Enchantments: [
{id: protection, lvl: 4},
{id: feather_falling, lvl: 3},
{id: thorns, lvl: 3},
{id: depth_strider, lvl: 3},
{id: unbreaking, lvl: 3},
{id: mending, lvl: 1}
]
}
},
{
Slot: 4,
id: iron_sword,
Count: 1b,
tag: {
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}
]
}
},
{
Slot: 5,
id: iron_pickaxe,
Count: 1b,
tag: {
Enchantments: [
{id: efficiency, lvl: 5},
{id: unbreaking, lvl: 3},
{id: fortune, lvl: 3},
{id: mending, lvl: 1}
]
}
},
{
Slot: 6,
id: iron_pickaxe,
Count: 1b,
tag: {
Enchantments: [
{id: efficiency, lvl: 5},
{id: silk_touch, lvl: 1},
{id: unbreaking, lvl: 3},
{id: mending, lvl: 1}
]
}
},
{
Slot: 7,
id: iron_axe,
Count: 1b,
tag: {
Enchantments: [
{id: sharpness, lvl: 5},
{id: efficiency, lvl: 5},
{id: unbreaking, lvl: 3},
{id: fortune, lvl: 3},
{id: mending, lvl: 1}
]
}
},
{
Slot: 8,
id: iron_shovel,
Count: 1b,
tag: {
Enchantments: [
{id: efficiency, lvl: 5},
{id: unbreaking, lvl: 3},
{id: fortune, lvl: 3},
{id: mending, lvl: 1}
]
}
},
{
Slot: 9,
id: iron_shovel,
Count: 1b,
tag: {
Enchantments: [
{id: efficiency, lvl: 5},
{id: silk_touch, lvl: 1},
{id: unbreaking, lvl: 3},
{id: mending, lvl: 1}
]
}
},
{
Slot: 10,
id: iron_hoe,
Count: 1b,
tag: {
Enchantments: [
{id: unbreaking, lvl: 3},
{id: mending, lvl: 1}
]
}
}
]
}
}
}
}]
}
}