Handle JSON output

I have the output from a API which is in JSON format, how can I display the JSON output in normal text using any available streamlit widget.

Hi @Pranav_Jha, welcome to the community !

If you don’t want the JSON formatting you can try dumping the json dict to a string and use st.write on the output,
Something like this should work,

import streamlit as st
import json

obj = {"x": 1, "y": 2}
st.write(obj)
st.write(json.dumps(obj))

That :point_up_2: generates this :point_down:
image

Hope it helps !

Hi, ist there an option to set a property of the JSON object - e.g. collapsed : false?

1 Like

Thanks @ [ash2shukla]

1 Like