i have json data shown below. using python encode list, dictionary , list json. final json data so:
{ "0": [3, 3, 3], "1": { "0": [0, 8, 9], "1": [1, 2, 3, 4, 10, 11], "2": [4] }, "2": [1, 1, 1, 1] }
my aim write type of scala function extract json data in way allows:
"0": [3, 3, 3]
list(3,3,3)
{"0":[0,8,9], ...}
hashmap[int,list[int]]
"2": [1, 1, 1, 1]
list(1,1,1,1)
note length of original python list , dictionary vary in size, , "0", "1", "2"
there representing list, dictionary , list in order.
i quite new scala , struggling on how without using external libraries. trying use spray-json it, since using newer version of scala (no built-in json parser).
that doesn't valid json me, means of json parsers use won't work. structure fixed? may want instead convert thats valid json.
eg.
{ "list" : [ 1,1,1], "someotherobject" : { "0" : [1,2,3] }, "anotherlist" : [9,8,7] }
then use argonaut (for example), , define decoder, tells how map json object types specify. see http://argonaut.io/doc/codec/