I am trying to parse and get selected data from a deep nested json data in Go Lang. I'm having issues navigating through the structure and accessing the data. The data is too deep and complex to be parsed with a-priori known structures in Go. Here is the URL of the file: -https://www.data.gouv.fr/api/1/datasets/?format=csv&page=0&page_size=20

I did some parsing with map interfaces and using a json string:

resultdata := map[string]interface {}

json.Unmarshal([]byte(inputbytestring), &resultdata) //Inputstring is the string containing the JSON data of the above URL

The problem:

  • How can turn resultdata into a map (of strings), so I can use methods available for maps?
  • The JSON data is nested and has several levels. How is it possible to access the lower level JSON fields? is it possible to unmarshal the data recursively?