JSON Encode an Array of Objects
·
169 words
·
1 minute read
This is how to convert any object within go, into the JSON data structure. In our example we’re using an array of Page objects, each with their own properties and encoding them. We’re then just printing this string to Stdout, but if we were using the net/http
to create an api, we would want to write to the http writer instead.
|
|