commit | 63fd64756accb63e272e1c4539e7bf66833cd21b | [log] [tgz] |
---|---|---|
author | yosuke-furukawa <yosuke.furukawa@gmail.com> | Wed Dec 03 23:40:33 2014 |
committer | yosuke-furukawa <yosuke.furukawa@gmail.com> | Wed Dec 03 23:40:33 2014 |
tree | 64a066c134689e6cfe341bb8c355f61e220986a2 | |
parent | 8d07c11edcbc0c2f5c4d528f4c0a4d59c6df6e36 [diff] | |
parent | d6c124659d1ed360cf27c5e5a40827265abeb6fd [diff] |
Merge branch 'master' of github.com:yosuke-furukawa/gojson5
JSON5 is Yet another JSON.
$ brew tap yosuke-furukawa/json5 $ brew install json5
$ json5 -c path/to/test.json5 # output stdout $ json5 -c path/to/test.json5 -o path/to/test.json # output path/to/test.json
$ go get github.con/yosuke-furukawa/gojson5
package main
import (
"encoding/json"
"fmt"
"github.com/yosuke-furukawa/json5/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", }
$ json5 -c example.json5 # output #{ # "key ": "Key does not need double quote", # "of": "course we can use json as json5", # "trailing ": "trailing comma is ok" #}