go - Golang - Parsing nested JSON -


i'm using go-worker process resque jobs. job has payload has nested json structure this:

[{   "key-a":"val-a",   "key-b":"val-b",   "files":[{     "key-a": [       {"a":"b","c": "d"},       {"e":"f","g": "h"}     ],     "key-b": [       {"a":"b","c": "d"},       {"e":"f","g": "h"}     ]   }] }] 

now go-worker gives me args ...interface{} represents json payload, not actual json text. there idiomatic way convert that(args) correct types (could use package this.) using type assertions manually seems bit tedious such thing.

if it's giving actual go objects (i.e. bunch of map[string]interface{} , not json string itself) there isn't can besides bunch of type assertions.

you re-marshall json parse again correct structs, that's bit of hack (and have no idea if performant or not).


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -