In this example, i want to get number of object(in this case, it is 2.)
[ {
"id_preklad": 95860,
"id_anime": 19761,
"jmeno_orig": null,
"img_url": null,
"id_dil": 1,
}, {
"id_preklad": 95861,
"id_anime": 19761,
"jmeno_orig": null,
"img_url": null,
"id_dil": 2,
} ]
CodePudding user response:
assign it to a variable and use built-in len() function:
json_var = [ {
"id_preklad": 95860,
"id_anime": 19761,
"jmeno_orig": null,
"img_url": null,
"id_dil": 1,
}, {
"id_preklad": 95861,
"id_anime": 19761,
"jmeno_orig": null,
"img_url": null,
"id_dil": 2,
} ]
print(len(json_var))
EDITED: it will error if you run the code, unless you define the null
CodePudding user response:
Solved using len(). Im an idiot.