commit | 66f9e9fe386860a7a0e1e8671238a317b52e00c1 | [log] [tgz] |
---|---|---|
author | yosuke-furukawa <yosuke.furukawa@gmail.com> | Wed Dec 03 06:05:54 2014 |
committer | yosuke-furukawa <yosuke.furukawa@gmail.com> | Wed Dec 03 06:05:54 2014 |
tree | ac4fa938f61915c91030461d391c880b93729de0 | |
parent | f08ee3503b078fe3d4f3bbf62ad57bdbee631031 [diff] | |
parent | f9ad85489268a9dff455f372a4a772d827f9415b [diff] |
Merge branch 'master' of github.com:yosuke-furukawa/gojson5
JSON5 is Yet another JSON.
package main
import (
"encoding/json"
"fmt"
"github.com/yosuke-furukawa/gojson5/encoding/json5"
"os"
)
func main() {
var data interface{}
dec := json5.NewDecoder(os.Stdin)
err := dec.Decode(&data)
if err != nil {
fmt.Println(err)
}
b, err := json.MarshalIndent(data, "", " ")
if err != nil {
fmt.Println(err)
}
fmt.Println(string(b))
}
// This is json5 demo // json5 can write comment in your json { key : "Key does not need double quote", // json specific "of" : "course we can use json as json5", trailing : "trailing comma is ok", }
$ gojson5 example.json5 # output #{ # "key ": "Key does not need double quote", # "of": "course we can use json as json5", # "trailing ": "trailing comma is ok" #}