Documentation ¶
Overview ¶
Package jsoncr provides method to remove comments and indentations in JSON.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Remove ¶
Remove comments and indentations from r.
Example ¶
package main import ( "encoding/json" "fmt" "strings" "github.com/thedevop1/jsoncr" ) func main() { const j = `// JSON with commments { "configDesc": "configuration data", // config comment /* configBool: false (default) */ "configBool": true // override default }` condenseJ, err := jsoncr.Remove(strings.NewReader(j)) if err != nil { fmt.Println(err) return } var z interface{} err = json.Unmarshal(condenseJ, &z) if err != nil { fmt.Println("error Unmarshal", err) return } fmt.Println(z) }
Output: map[configBool:true configDesc:configuration data]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.