I'm currently trying to build a Minecraft (1.16.3) Advendure Map. On this map I have to use command blocks to create a villager that exchanges 64 coal for a lever that can only be placed on coal blocks. I already have the following command - it just doesn't work:
/ summon villager ~ ~ 1 ~ {VillagerData: {profession: librarian, level: 99, type: plains}, CustomName: "\" Coal Key \ "", Offers: {Recipes: [{buy: {id: coal, Count: 64}, sell: {id: lever, CanPlaceOn: ["minecraft: coal_block"], Count: 1}, rewardExp: 0b, maxUses: 99999}]}}
/ summon villager ~ ~ ~ {CustomNameVisible: 1b, CustomName: '{"text": "Coal Key"}', VillagerData: {level: 99, profession: "minecraft: librarian", type: "minecraft: plains"}, Offers: {Recipes: [{maxUses: 99999, buy: {id: "minecraft: coal", Count: 64b}, sell: {id: "minecraft: lever", Count: 1b, tag: {CanPlaceOn: ["minecraft: coal_block "]}}}]}}