Function signature[source] | |
---|---|
st.json(body, *, expanded=True) | |
Parameters | |
body (object or str) | The object to print as JSON. All referenced objects should be serializable to JSON as well. If object is a string, we assume it contains serialized JSON. |
expanded (bool or int) | The initial expansion state of the JSON element. This can be one of the following:
Regardless of the initial expansion state, users can collapse or expand any key-value pair to show or hide any part of the object. |
Example
import streamlit as st st.json( { "foo": "bar", "stuff": [ "stuff 1", "stuff 2", "stuff 3", ], "level1": {"level2": {"level3": {"a": "b"}}}, }, expanded=2, )
Still have questions?
Our forums are full of helpful information and Streamlit experts.