We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I check if the address field below is null?
package main import ( "fmt" "github.com/smallfish/simpleyaml" ) var data = []byte(` name: smallfish age: 99 bool: true bb: cc: dd: - 111 - 222 - 333 address: null `) func main() { y, err := simpleyaml.NewYaml(data) if err != nil { // ERROR } if v, err := y.Get("name").String(); err == nil { fmt.Println("value:", v) } if v, err := y.Get("age").Int(); err == nil { fmt.Println("value:", v) } if v, err := y.Get("bool").Bool(); err == nil { fmt.Println("value:", v) } if v, err := y.Get("bb").Get("cc").Get("dd").Array() ; err == nil { fmt.Println("value:", v) } if v, err := y.Get("bb").Get("cc").Get("dd").GetIndex(1).Int() ; err == nil { fmt.Println("value:", v) } if v, err := y.GetPath("bb", "cc", "dd").Array() ; err == nil { fmt.Println("value:", v) } }
The text was updated successfully, but these errors were encountered:
http://yaml.org/type/null.html
Sorry, something went wrong.
in my case, referring to an explicit null value as described here:
https://www.calhoun.io/how-to-determine-if-a-json-key-has-been-set-to-null-or-not-provided/
No branches or pull requests
How do I check if the address field below is null?
The text was updated successfully, but these errors were encountered: