json-comments-rs
json-comments-rs copied to clipboard
Inject comments
I'd like the ability to inject comments into a json string. This is the right crate to put it, based on the name.
Details:
I have configuration files that have comments. The files are meant to be edited manually (text editor) or in a launcher program.
I already mentioned that it's invalid json but the reply I got is that they chose RapidJSON exactly because it allowed that. The launcher is C++ (GUI) mixed with rust code.
Right now all the comments that guide a user disappear when the launcher writes to the config file. This is an obvious usability problem, so I want to make the launcher write default comments with the config.
As a minimal example, I want to turn this:
{
"ms_per_game_cycle": 25
}
into this:
{
// Number of milliseconds for one game cycle. Default: 25
"ms_per_game_cycle": 25
}