Fetch specific column(attribute) from json

Hello,

I am new to Streamlit and I am trying to invoke a Purview Rest API call that returns JSON. This JSON has multiple attributes and I would like to fetch a specific column(attribute) from it. Below is the piece of code

image

The line st.json(data[0]) just returns first index. I want to fetch a specific column from all the results.

For example : st.json(data[‘guid’])

Btw, I have tried this above line too and it doesn’t work for me.

Am I doing anything wrong here or how can I change my code to get a specific attribute ?

Any help here is greatly appreciated.

Thank you!

Jigar

“It doesn’t work” doesn’t tell much about what’s going on. JSON objects do have attributes, other JSON values don’t. This is how you get the value (as a python object) of an attribute from a JSON object:

import json

text = """{"name": "John Doe"}"""
data = json.loads(text)
value = data["name"]

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.