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
52.7%
No, throw comments away
15%
It's complicated
32.3%
Poll ended at .

@fasterthanlime I'm late, didn't vote, but here's my use case in favor of them.

I run a game server hosting site (full stack Rust) where users edit game config files in a nice web gui or edit the files directly. Games often have comments in their default config files to explain what the values do. If editing from the GUI strips those, then it makes editing the file a lot more confusing for users (e.g. when they need to edit a field we haven't added to the gui yet).

@fasterthanlime Additionally if parsers support reading comments, we can build tools for initially populating the help text for our web gui with them which saves a lot of manual copy pasting. (Some games have literally hundreds of settings)
@paul so that's a middle-ground between "throw away comments" and "allow re-serializing down to the exact same whitespace/comment location/etc." ?

@fasterthanlime For our use case I probably would prefer if it kept all formatting and ordering. Sometimes the grouping of settings helps with context etc., but I probably wouldn't bother writing my own parser if there was an existing one that kept comments and lost some formatting.

So yeah, kind of middle ground, but would still get some value out of full preservation too.