Josh Baker
Josh Baker
> Is there an official way how to do that? No official way, but what I usually do is: ```go var sb strings.Builder sb.WriteByte('[') var i int res.ForEach(_, value gjson.Result)...
Another way is to use the `~` operator, which converts a value to a boolean before comparison. There's some information on how it works at the bottom of the section...
Try `[APIResponse.APIResult.items].@flatten.#.item` This uses the [MultiPath](https://github.com/tidwall/gjson/blob/master/SYNTAX.md#multipaths) syntax along with the `@flatten` modifier.
Yes, your hunch is right. The API is designed to support a single-pass operation on multiple paths, but at this moment the implementation executes each path serially. A while back...
> Instead, there's a True "type" and a False "type", which to me seem to be no "types" at all. The layout and ordering of each `Type`, including True and...
Gjson return predictable values on valid json. Your json is not valid: ``` {"a":a6ed68a1cc964b430e1e40254347367f08e4eb5eeaf0852d5648022873b50c07} ``` I recommend that you can either, A. Check your json before using `gjson.Get` by using...
I recommend using `sjson.Set` instead of `SetRaw`. The `Set` takes care of converting the input, in the case of a string it adds quotations. `SetRaw` is for setting "raw" json.
The SetRaw is useful for quickly embedding a block of raw json, usually an object or array. ```json { "id": 98120398, "info": "something" } ``` ``` jsondoc = sjson.SetRaw(jsondoc, "info",...
Not sure if this helps but you can use a map type with Set. Set is pretty flexible with value types. ```go var m map[string]interface{} json.Unmarshal([]byte(`{ "name": { "first": "Tom",...
> /usr/share/go/**1.9** It appears that the version of Go on that computer too old for gjson. The minimum requirements for gjson is Go 1.12.