config := `{ "name": "John Doe", "email": "[email protected]", "age": 30 }` obj, _ := jsonconfig.Load(config) name := obj.RequiredString("name") fmt.Println(name) // Output: John Doe
config := `{ "email": "[email protected]", "age": 30 }` obj, _ := jsonconfig.Load(config) name, err := obj.RequiredStringErr("name") if err != nil { fmt.Println(err) // Output: Required field 'name' missing in JSON config }The above examples demonstrate how easy it is to access required string values from JSON objects using the go camlistore.org.pkg.jsonconfig library.