commit | 07fdad7a3c55f2098b172ea58890470c07f7d392 | [log] [tgz] |
---|---|---|
author | Yosuke Furukawa <yosuke.furukawa@gmail.com> | Tue Jan 13 04:26:02 2015 |
committer | Yosuke Furukawa <yosuke.furukawa@gmail.com> | Tue Jan 13 04:26:02 2015 |
tree | 4d290f8abb0a944be51c2de6d275e2696e511057 | |
parent | 6252c63b2f524f6f412b413d49020c4235a7baa7 [diff] | |
parent | 5e5c0c6d15e32030370b5c8b1761e00aefec7a2f [diff] |
Merge pull request #4 from rasa/patch-1 readme typo
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.com/yosuke-furukawa/json5
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" #}