{"modulePath":"github.com/sqlatlas/gui","version":"v6.1.6+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package simplejson\n\n## Functions\n\n```go\nfunc Version() string\n```\nreturns the current implementation version\n\n## Types\n\n```go\ntype Json struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New() *Json\n```\nNew returns a pointer to a new, empty \\`Json\\` object\n\n```go\nfunc NewFromAny(data interface{}) *Json\n```\nNew returns a pointer to a new, empty \\`Json\\` object\n\n```go\nfunc NewFromReader(r io.Reader) (*Json, error)\n```\nNewFromReader returns a \\*Json by decoding from an io.Reader\n\n```go\nfunc NewJson(body []byte) (*Json, error)\n```\nNewJson returns a pointer to a new \\`Json\\` object after unmarshaling \\`body\\` bytes\n\n```go\nfunc (j *Json) Array() ([]interface{}, error)\n```\nArray type asserts to an \\`array\\`\n\n```go\nfunc (j *Json) Bool() (bool, error)\n```\nBool type asserts to \\`bool\\`\n\n```go\nfunc (j *Json) Bytes() ([]byte, error)\n```\nBytes type asserts to \\`\\[]byte\\`\n\n```go\nfunc (j *Json) CheckGet(key string) (*Json, bool)\n```\nCheckGet returns a pointer to a new \\`Json\\` object and a \\`bool\\` identifying success or failure\n\nuseful for chained operations when success is important:\n\n\tif data, ok := js.Get(\"top_level\").CheckGet(\"inner\"); ok {\n\t    log.Println(data)\n\t}\n\n```go\nfunc (j *Json) Del(key string)\n```\nDel modifies \\`Json\\` map by deleting \\`key\\` if it is present.\n\n```go\nfunc (j *Json) Encode() ([]byte, error)\n```\nEncode returns its marshaled data as \\`\\[]byte\\`\n\n```go\nfunc (j *Json) EncodePretty() ([]byte, error)\n```\nEncodePretty returns its marshaled data as \\`\\[]byte\\` with indentation\n\n```go\nfunc (j *Json) Float64() (float64, error)\n```\nFloat64 coerces into a float64\n\n```go\nfunc (j *Json) FromDB(data []byte) error\n```\n\n```go\nfunc (j *Json) Get(key string) *Json\n```\nGet returns a pointer to a new \\`Json\\` object for \\`key\\` in its \\`map\\` representation\n\nuseful for chaining operations (to traverse a nested JSON):\n\n\tjs.Get(\"top_level\").Get(\"dict\").Get(\"value\").Int()\n\n```go\nfunc (j *Json) GetIndex(index int) *Json\n```\nGetIndex returns a pointer to a new \\`Json\\` object for \\`index\\` in its \\`array\\` representation\n\nthis is the analog to Get when accessing elements of a json array instead of a json object:\n\n\tjs.Get(\"top_level\").Get(\"array\").GetIndex(1).Get(\"key\").Int()\n\n```go\nfunc (j *Json) GetPath(branch ...string) *Json\n```\nGetPath searches for the item as specified by the branch without the need to deep dive using Get()'s.\n\n\tjs.GetPath(\"top_level\", \"dict\")\n\n```go\nfunc (j *Json) Int() (int, error)\n```\nInt coerces into an int\n\n```go\nfunc (j *Json) Int64() (int64, error)\n```\nInt64 coerces into an int64\n\n```go\nfunc (j *Json) Interface() interface{}\n```\nInterface returns the underlying data\n\n```go\nfunc (j *Json) Map() (map[string]interface{}, error)\n```\nMap type asserts to \\`map\\`\n\n```go\nfunc (j *Json) MarshalJSON() ([]byte, error)\n```\nImplements the json.Marshaler interface.\n\n```go\nfunc (j *Json) MustArray(args ...[]interface{}) []interface{}\n```\nMustArray guarantees the return of a \\`\\[]interface{}\\` (with optional default)\n\nuseful when you want to iterate over array values in a succinct manner:\n\n\tfor i, v := range js.Get(\"results\").MustArray() {\n\t\tfmt.Println(i, v)\n\t}\n\n```go\nfunc (j *Json) MustBool(args ...bool) bool\n```\nMustBool guarantees the return of a \\`bool\\` (with optional default)\n\nuseful when you explicitly want a \\`bool\\` in a single value return context:\n\n\tmyFunc(js.Get(\"param1\").MustBool(), js.Get(\"optional_param\").MustBool(true))\n\n```go\nfunc (j *Json) MustFloat64(args ...float64) float64\n```\nMustFloat64 guarantees the return of a \\`float64\\` (with optional default)\n\nuseful when you explicitly want a \\`float64\\` in a single value return context:\n\n\tmyFunc(js.Get(\"param1\").MustFloat64(), js.Get(\"optional_param\").MustFloat64(5.150))\n\n```go\nfunc (j *Json) MustInt(args ...int) int\n```\nMustInt guarantees the return of an \\`int\\` (with optional default)\n\nuseful when you explicitly want an \\`int\\` in a single value return context:\n\n\tmyFunc(js.Get(\"param1\").MustInt(), js.Get(\"optional_param\").MustInt(5150))\n\n```go\nfunc (j *Json) MustInt64(args ...int64) int64\n```\nMustInt64 guarantees the return of an \\`int64\\` (with optional default)\n\nuseful when you explicitly want an \\`int64\\` in a single value return context:\n\n\tmyFunc(js.Get(\"param1\").MustInt64(), js.Get(\"optional_param\").MustInt64(5150))\n\n```go\nfunc (j *Json) MustMap(args ...map[string]interface{}) map[string]interface{}\n```\nMustMap guarantees the return of a \\`map\\[string]interface{}\\` (with optional default)\n\nuseful when you want to iterate over map values in a succinct manner:\n\n\tfor k, v := range js.Get(\"dictionary\").MustMap() {\n\t\tfmt.Println(k, v)\n\t}\n\n```go\nfunc (j *Json) MustString(args ...string) string\n```\nMustString guarantees the return of a \\`string\\` (with optional default)\n\nuseful when you explicitly want a \\`string\\` in a single value return context:\n\n\tmyFunc(js.Get(\"param1\").MustString(), js.Get(\"optional_param\").MustString(\"my_default\"))\n\n```go\nfunc (j *Json) MustStringArray(args ...[]string) []string\n```\nMustStringArray guarantees the return of a \\`\\[]string\\` (with optional default)\n\nuseful when you want to iterate over array values in a succinct manner:\n\n\tfor i, s := range js.Get(\"results\").MustStringArray() {\n\t\tfmt.Println(i, s)\n\t}\n\n```go\nfunc (j *Json) MustUint64(args ...uint64) uint64\n```\nMustUInt64 guarantees the return of an \\`uint64\\` (with optional default)\n\nuseful when you explicitly want an \\`uint64\\` in a single value return context:\n\n\tmyFunc(js.Get(\"param1\").MustUint64(), js.Get(\"optional_param\").MustUint64(5150))\n\n```go\nfunc (j *Json) Set(key string, val interface{})\n```\nSet modifies \\`Json\\` map by \\`key\\` and \\`value\\` Useful for changing single key/value in a \\`Json\\` object easily.\n\n```go\nfunc (j *Json) SetPath(branch []string, val interface{})\n```\nSetPath modifies \\`Json\\`, recursively checking/creating map keys for the supplied path, and then finally writing in the value\n\n```go\nfunc (j *Json) String() (string, error)\n```\nString type asserts to \\`string\\`\n\n```go\nfunc (j *Json) StringArray() ([]string, error)\n```\nStringArray type asserts to an \\`array\\` of \\`string\\`\n\n```go\nfunc (j *Json) ToDB() ([]byte, error)\n```\n\n```go\nfunc (j *Json) Uint64() (uint64, error)\n```\nUint64 coerces into an uint64\n\n```go\nfunc (j *Json) UnmarshalJSON(p []byte) error\n```\nImplements the json.Unmarshaler interface.\n\n","path":"github.com/sqlatlas/gui/pkg/components/simplejson","name":"simplejson","synopsis":"","isRedistributable":true}
