is there any plans for Comments in Json ? `@Commen...
# serialization
n
is there any plans for Comments in Json ?
@Comment("what the thing does")
on a filed and
Json(enableComments = true)
to allow parsing and serializing them
🚫 1
s
the JSON spec doesn’t support comments, so I’d say probably not, but I’m also not JetBrains
o
Exactly, there are no comments in JSON. There are other formats, like HOCON, for configuration.
âž• 1
s
That being said, unquoted JSON (the JSON5 spec) does support comments.
But adding comment support to only unquoted JSON would be difficult and inconsistent
n
hmm then maybe i should see if i can adapt the JSON parser for JSON5
g
What is your use case? I found hocon as much more suitable and powerful format for configs
n
well both configs and serializing data in human readable format (for debugging and version control)
in that case i'd like to have comments along with some data to explain why its there or what added it
g
In this case hocon is a good choice imo Also supported out of the box by kotlinx.serialization