[
{
"key": "abc123",
"columns": [
[
"2015-08-05 12\\:38\\:02+0000:",
"",
1439565881058000
],
[
"2015-08-05 12\\:38\\:02+0000:type",
"1",
1439565881058000
],
[
"2015-08-05 12\\:38\\:02+0000:duration",
"21",
1439565881058000
],
[
"2015-08-05 12\\:38\\:02+0000:first_name",
"abc",
1439565881058000
],
[
"2015-08-05 12\\:38\\:02+0000:last_name",
"xyz",
1439565881058000
],
[
"2015-08-05 12\\:38\\:02+0000:number",
"012456789",
1439565881058000
]
]
}
]
Asked
Active
Viewed 2,925 times
-3

Remi Guan
- 21,506
- 17
- 64
- 87

Sarthak Prakash
- 1
- 1
- 3
-
What have you tried so far? You're more likely to get helpful answers if your question is about a specific problem, rather than something generic. – Kevin Hooke Nov 08 '15 at 06:52
1 Answers
1
use json library
data = json.loads(your_jsondata)
you can access your json data by calling it like
data[0]['key']
to get key

Harwee
- 1,601
- 2
- 21
- 35
-
I have done as above mentioned but still I am getting below error >>> import json >>> from pprint import pprint >>> >>> with open('/Users/xxx/Documents/sample.json') as data_file: ... data = json.load(data_file) ... >>> data['key'] Traceback (most recent call last): File "
", line 1, in – Sarthak Prakash Nov 08 '15 at 05:50TypeError: list indices must be integers, not str -
@SarthakPrakash what you have is an array so you should call it like data[0]['key'] – Harwee Nov 08 '15 at 05:56
-
-
@SarthakPrakash just use columns instead of key and you get array of columns data[0]['columns'] – Harwee Nov 08 '15 at 06:02