#Converting Raw JSON into structured GO struct with parent child relationships

10 messages · Page 1 of 1 (latest)

thick halo
#

map[string]Categories would be:

{
 "thingy": {
    "name": "Buku",
    "childs": [{
            "name": "Arsitektur Desain",
            "childs": [{
                "name": "buku bangunan",
                "childs": []
            }]
        },
        {
            "name": "kedokteran",
            "childs": [{
                "name": "buku farmasi"
            }]
        }
    ]
  },
  "other thingy":{
    "name": "Buku",
    "childs": [{
            "name": "Arsitektur Desain",
            "childs": [{
                "name": "buku bangunan",
                "childs": []
            }]
        },
        {
            "name": "kedokteran",
            "childs": [{
                "name": "buku farmasi"
            }]
        }
    ]
  }
}
#

@blazing lagoon

var categoriesJSON Categories

should work

blazing lagoon
#

all the data is the type of Categories struct

thick halo
#

idk

pine grail
#

I don't get it, what's wrong with var categoriesJSON Categories?

blazing lagoon
#

oh my bad i didnt see that haha

#

thanks @thick halo and @pine grail

pine grail
#

Seems fine?

blazing lagoon
#

okay sounds great 🙂