How to parse JSON data without struct in Go

How to parse JSON data without struct in Golang

In using Golang, we sometimes need to parse a JSON data without knowing or specifying a concrete type struct. We can do this by converting (json.Unmarshal) JSON data into an interface{}. We can then use it like a map. Accessing it like for example m[“username”].(string) Below is an example application that converts a JSON string into an interface{}. The statements from line 18 to 23 implements the JSON unmarshall without a concrete struct....

January 2, 2020 · John Pili