This is a way of taking a string and forming an object array with it. These can then be used and manipulated as you please. This uses the json encode as well just to demonstrate it works. The primary function used to process the json is the json.Unmarshal method.
package main import ( "encoding/json" "fmt" "log" "os" ) type Page struct { Title string Filename string Content string } type Pages []Page var rawJson = []byte(`[{"Title":"First Page","Filename":"page1.

Source link


Please enter your comment!
Please enter your name here