Canplaceon and Named in villager trade

I can't seem to have a villager trade a named item with CanPlaceOn tag.

I read somewhere that this is how it should be formatted, but it is still not working.

Here is a simpler version of the command I'm using: (this one works, but it doesn't have the custom name tag.

/summon villager ~ ~1.5 ~ {VillagerData:{profession:nitwit,level:99,type:plains},CustomName:"\"Floor Keys\"",Offers:{Recipes:[{buy:{id:flint,Count:1},sell:{id:end_portal_frame,Count:1,tag:{CanPlaceOn:["minecraft:obsidian"]}},maxUses:12}]}}

The only difference is more trades of other materials, but I can copy and paste since the output should be the same.

I've tried a ton of different things: Quotes, no quotes, but the CanPlaceOn tag doesn't seem to be compatible with the named item?


The issue is here:

tag:{CanPlaceOn:[end_portal_frame]},{display:{Name:"\"Floor Key\""}}

This isn’t valid NBT. To put multiple keys in tag (or any compound NBT tag), do this:

tag:{CanPlaceOn:[end_portal_frame],display:{Name:"\"Floor Key\""}}