Documentation ¶
Overview ¶
Package jsonutil provides methods for working with JSON data
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GzipLevel = gzip.BestSpeed
GzipLevel is default Gzip compression level
Functions ¶
func Read ¶
Read reads and decode JSON file
Example ¶
var data = make(map[string]int) err := Read("/path/to/file.json", data) if err != nil { fmt.Printf("Error: %v\n", err) }
Output:
func ReadGz ¶
ReadGz reads and decode gzipped JSON file
Example ¶
var data = make(map[string]int) err := ReadGz("/path/to/file.gz", data) if err != nil { fmt.Printf("Error: %v\n", err) }
Output:
func Write ¶
Write encodes data to JSON and save it to file
Example ¶
var data = make(map[string]int) data["john"] = 100 data["bob"] = 300 err := Write("/path/to/file.json", data, 0600) if err != nil { fmt.Printf("Error: %v\n", err) }
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.