Skip to content
Advertisement

Get label name on JSON Python

i am a newbie on JSON, I want to get just ‘label’ from my JSON data here is my JSON data, i am using json.dumps to turn it into JSON format

JavaScript

I want to print just the label of my JSON data, is there any possible way to do it? The result that i want is

JavaScript

Advertisement

Answer

You must convert json to dict and then the labels are the same as the keys.

JavaScript

output:

JavaScript

Optional:

If you want to access the values ​​of each item

JavaScript

Python2

JavaScript

Python3

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement