Q:

JSON to dimensional array

I'm trying to convert this JSON:
{
 "labels": ["time", "free", "used", "cached", "buffers"],
    "data": [
      [1478635365, 26.91797, 460.9844, 479.3906, 5.80859]
  ]
}

to var['time'] = 1478635365, var['free'] = 26.91797 ...
Can you help me?

A:

Here is the dict comprehension expression to create var dict using zip() as:
>>> my_json = { "labels": ["time", "free", "used", "cached", "buffers"], "data": [ [ 1478635365, 26.91797, 460.9844, 479.3906, 5.80859] ] }

>>> var = {k: v for k, v in zip(my_json["labels"], my_json["data"][0])}

Now you may access the values from var dict as:
>>> var["time"]
1478635365
>>> var["free"]
26.91797

