The command /give cannot enchant an item.
I am trying to run a command (/give @s minecraft:diamond_sword[minecraft:enchantments={levels:{"minecraft:sharpness":10}}]) and failed. But this command works in 1.21.4
Linked issues
is duplicated by 2
Comments 2
According to the [changelog for 25w04a|https://www.minecraft.net/en-us/article/minecraft-snapshot-25w04a], the reported behavior is intentional. {quote} h4. {{enchantments}} and {{stored_enchantments}} Components * […] * These components now always use their simplified form, with the {{levels}} field inlined to top-level ** e.g. {{enchantments=\{levels:\{sharpness:2\}\}}} -> {{enchantments=\{sharpness:2\}}} {quote}
As mentioned in this comment, the format changed in 25w04a.