Description
Is your feature request related to a problem? Please describe.
I use the new Windows Terminal, which uses JsonCpp for parsing JSON configuration files, and currently requires those configuration files to be manually edited. It provides a file with defaults, from which I copy paste lines with settings for individual profiles (represented as JSON objects) into my user configuration file, then change the default values. However, those setting lines end with a comma, so if I paste them at the end of an existing profile object and forget to remove the comma, JsonCpp will fail to parse the configuration file and the Windows Terminal will pop up with a "Failed to reload settings" dialog.
More generally, this problem occurs for both objects and arrays when manually constructing JSON files or copy-pasting objects from ECMAScript code, which ignores trailing commas in object and array literals.
Describe the solution you'd like
I want JsonCpp, either by default or with a configuration setting, to ignore one trailing comma in objects and arrays while deserializing. I don't expect JsonCpp to keep any reference of this trailing comma or to be able to recreate it while serializing.
Describe alternatives you've considered
The main alternative I see is to keep the current behavior and to strictly enforce the correctness of parsed JSON. However, JsonCpp already supports comments, which is non-standard, so supporting trailing commas doesn't seem at odds with the direction of the project.
Between the alternatives of ignoring a trailing comma by default or by configuration, this depends on whether JsonCpp is allowed to break backwards compatibility by parsing files that would previously have resulted in an syntax error. I don't know the project stance on this.
JsonCpp could optionally support retaining and serializing trailing commas, but I don't see any value in that, except being able to more faithfully reproduce the source when deserializing and reserializing a file.
Additional context
This feature was also requested back in 2006 on Sourceforge. @cdunn2001 back then remarked:
I see this is difficult the way readObject() and readArray() are written. Oh, well. It would be nice someday...