Is there a simple way in Go to check whether given JSON is either an Object {}
or array []
?
The first thing that comes to mind is to json.Unmarshal()
into an interface, and then see if it becomes a map, or a slice of maps. But that seems quite inefficient.
Could I just check if the first byte is a {
or a [
? Or is there a better way of doing this that already exists.