mirror of
https://github.com/therootcompany/golib.git
synced 2025-10-07 01:28:19 +00:00
27 lines
432 B
Go
27 lines
432 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/therootcompany/golib/colorjson"
|
|
)
|
|
|
|
func main() {
|
|
str := `{
|
|
"str": "foo",
|
|
"num": 100,
|
|
"bool": false,
|
|
"null": null,
|
|
"array": ["foo", "bar", "baz"],
|
|
"obj": { "a": 1, "b": 2 }
|
|
}`
|
|
|
|
var obj map[string]any
|
|
_ = json.Unmarshal([]byte(str), &obj)
|
|
|
|
// Marshall the Colorized JSON
|
|
s, _ := colorjson.Marshal(obj)
|
|
fmt.Println(string(s))
|
|
}
|