A parser library (JSONC, YAML, TOML) should optionally let you parse comments — what you do with them is your prerogative.
Yes, your job is to parse
No, throw comments away
It's complicated
Poll ended at .
@TheConstructor @fasterthanlime this is a common use case for me, but in that case it’s a lot wider: it’s „keep all formatting intact, whitespace and indent and all, including comments”. Comments are just a part of keeping the meaningless formatting intact.
A parser/serializer that lets me make programmatic semantic changes to a file created and edited by humans without mangling it and generates a minimal text-level diff is *golden*.