Skip to content

New: Commented JSON config - inline comments

Latest
Compare
Choose a tag to compare
@kambahr kambahr released this 22 Jan 06:34
· 5 commits to main since this release

Commented JSON config

Use comment lines using # at the beginning of each line, within a line ; and /* */ blocks
anywhere in the json block.

func LoadJSONConfig(path string) (map[string]interface{}, []byte)
# Top notes
# some more text...
{
    # more notes...
    "my-info":
    [
        # notes for object one
        {        
            # my comments...
            "some-key" : "some value /* notes go here */",        
                        
            # notes for this key
            "some-array" :
            [
                "value 1",  # inline comment will also be omitted
                /* more notes */
                "value 2"
            ]
        } 
    ]
}