Popularity
0.7
Growing
Activity
4.2
Declining
6
1
0

Description

The library provides a JSONC (json with comments) to JSON streamer. It supports multiline comments ( /* Comment */) and one-line comments ( // Comment ).

Programming language: Go
License: MIT License
Tags: Configuration     Json     Go     Golang    
Latest version: v1.1.0

JSONcJSON alternatives and similar packages

Based on the "JSON" category.
Alternatively, view JSONcJSON alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of JSONcJSON or a related project?

Add another 'JSON' Package

README

JSONcJSON

Version Build Status Go Report Card Coverage Status PkgGoDev

The library provides a JSONC (json with comments) to JSON streamer. It supports multiline comments ( /* Comment */) and one-line comments ( // Comment ).

For example, it translates JSON with comments:

{
    /*
        JSONcJSON
        =^._.^= ∫
    */
    "Hello": "world" // In-line comments are also supported.
}

to a valid JSON:

{
    "Hello": "world"
}

Installing:

go get github.com/hedhyw/jsoncjson

Usage example:

More [examples](./example_test.go).

// Converting jsonc to json and decoding.

const in = `
{
    "Hello": "world"
    /* Perhaps the truth depends on a walk around the lake. */
}
`

// The reader can be anything.
// For example: file, strings.NewReader(), bytes.NewReader(), ...
var r = jsoncjson.NewReader(strings.NewReader(in))

var data map[string]interface{}
_, = json.NewDecoder(r).Decode(&data)

fmt.Printf("%+v\n", data) // map[Hello:world].