Thanks for the new ItemStack serialization API introduced in build 298 - it should solve many issues I currently have with the Bukkit ItemStack serialization. I just played around with it considering to migrate my plugin and discovered that there is an Issue serializing/deserializig custom ItemStack names. Would be great to get it fixed!
Serializing and then deserializing a named item should result in an identical ItemStack
When serializing and then deserializing a named item, the name contains the entire JSON object instead of just the text.
Take an ItemStack with a custom name (either by Plugin or a native one like an ominous banner). Then serialize it via ItemStack#serializeAsBytes() followed by ItemStack.deserializeBytes(...).
Paper version git-Paper-304 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)
Examples after deserialization:


The same issue occurs with the content of a Book and Quill. In contrast, already signed books are identical to the original stack as expected.

I believe this is due to https://github.com/PaperMC/Paper/blob/master/Spigot-Server-Patches/0463-Add-Raw-Byte-ItemStack-Serialization.patch#L93 which was done by aikar right before the merge.
Dangit forgot to pass that dataVersion variable in place of that -1.
Thanks for the quick fix!
Most helpful comment
Dangit forgot to pass that dataVersion variable in place of that -1.