Is there an intermediate level library for Go that can be used to read and write JSON? I need to be able to walk the JSON data structure when reading and need to construct the JSON structure piece by piece. I came across https://github.com/tidwall/gjson which can read JSON but I also need to write JSON but didn’t find much else.
An example of such a library form the Java world is https://github.com/stleary/JSON-java, is there an equivalent for the Go community?
I looked at encoding/json, there is the very high-level marshal and unmarshal support (which is nice) and I also noticed some low-level support for reading tokens but there didn’t appear to be an intermediate level, unless I am mistaken? For example, I’d like to read an entire array of elements, to check is an element exists etc. In java or other languages you right type something like this to read in an array from JSON:
JSONArray arr = obj.getJSONArray(“posts”);
I was wondering id there was anything similar in Go?