M
M
MrTiming2020-03-08 18:59:47
Python
MrTiming, 2020-03-08 18:59:47

How to access (count) JSON data (In Pyton)?

There is this kind of JSON file:
[
null,
{"id":1,"list":
[
{"code":355,"indent":0,"parameters":["//ここでONオフを決める、中で数を入れる、"]},
{"code":655,"indent":0,"parameters":["//オフのとき数字を入れても、動かない"]},
{"code": 655,"indent":0,"parameters":["//オンのとき数字を0にしておけば良い"]},
{"code":111,"indent":0,"parameters":[0,161 ,0]},
{"code":101,"indent":1,"parameters":["",0,0,2]},
{"code":401,"indent":1,"parameters" :["You have this."]},
{"code":401,"indent":1,"parameters":["Skip it?"]},
{"code":102,"indent":1,"parameters":[["Yes","No"],0,0,2,0]},
{"code": 402,"indent":1,"parameters":[0,"Yes"]},
{"code":121,"indent":2,"parameters":[1,1,0]},
{"code ":0,"indent":2,"parameters":[]},
{"code":402,"indent":1,"parameters":[1,"No"]},
{"code":117,"indent":2,"parameters":[2]},
{" code":121,"indent":2,"parameters":[1,1,0]},
{"code":0,"indent":2,"parameters":[]},
{"code": 404,"indent":1,"parameters":[]},
{"code":0,"indent":1,"parameters":[]},
{"code":411,"indent":0, "parameters":[]},
{"code":117,"indent":1,"parameters":[2]},
{"code":121,"indent":1,"parameters":[1, 1,0]},
{"code":121,"indent":1,"parameters":[161,161,0]},
{"code":0,"indent":1,"parameters":[]},
{"code":412,"indent":0,"parameters":[]},
{"code":0," indent":0,"parameters":[]}
],
"name":"sceneCheck_01","switchId":1,"trigger":0},
...
]
How can I find out the value of "parameters" for a certain code ("code")?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
D
Dr. Bacon, 2020-03-08
@bacon

Open the tutorial and read how to work with data structures - list and dict

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question