diff --git a/parser.go b/parser.go index 885e184..3b4dc49 100644 --- a/parser.go +++ b/parser.go @@ -2,10 +2,11 @@ package fastjson import ( "fmt" - "github.com/valyala/fastjson/fastfloat" "strconv" "strings" "unicode/utf16" + + "github.com/valyala/fastjson/fastfloat" ) // Parser parses JSON. @@ -559,6 +560,16 @@ func (o *Object) Visit(f func(key []byte, v *Value)) { } } +// GetKeys returns a slice of strings of all the keys of the +// parsed JSON object. +func (o *Object) GetKeys() []string { + var keys []string + for _, key := range o.kvs { + keys = append(keys, key.k) + } + return keys[:] +} + // Value represents any JSON value. // // Call Type in order to determine the actual type of the JSON value.