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 feel like context is important on this. iiuc this is about whether to do this for a serde-like API and would only track comments and not general formatting. There is also the large question of how comments get associated with a value.

@fasterthanlime Full format preserving on edits is non-trivial and should generally handled separately from other parsing.

If you are working with a serde-like API, then it is very complicated to carry forward all formatting. This is especially true for formats with more flexible styling like yaml and toml. For example in toml, you have 3 different ways to define tables and sort order is a cross-table concern.

Whether you do serde-like or work with a Value that has the logical structure, there is a major performance impact to carry forward formatting. In a serde-like API, it is also quite invasive on your types.