/give @p minecraft:diamond_sword[...] 1
/give @p minecraft:diamond_sword[enchantments={"minecraft:sharpness":5}] 1
/give @p minecraft:spawner[block_entity_data={...}] 1