Hi,
Would it be possible to make the streamlit.json() function accept a collapse=True argument to collapse values that are objects.
For example:
Show
{
“names” : [“Amber”, “Simone”, “Paul”]
}
As
{
“names”: […]
}
When streamlit.json(body, collapse=True)
Thank you,
Francis
Hi @francisj !
First, welcome to the Streamlit community!!!
This is a good suggestion! I wen’t ahead and made a feature request on GitHub for you, feel free to add anything I might have missed!
opened 07:58PM - 15 Sep 21 UTC
enhancement
needs triage
_(Note, you don't have to fill out every section here. They're just here for gui… dance. That said, nicely detailed feature requests are more likely to get eng attention sooner)_
### Problem
Have a parameter for st.json(body, collapse) where the default is `False` but you can set it to `True`. This would allow developers to choose if the json file is expanded or collapsed when rendered on the Streamlit app.
Requested by a community member, link to forum post:
https://discuss.streamlit.io/t/json-collapse-option/17159
### Solution
**MVP:** a parameter to set the view of a json file on the first render in Streamlit
Happy Streamlit-ing!
Marisa
Amazing, thank you @Marisa_Smith !
I’ve really been enjoying streamlit so far. Great for prototyping and will soon test on small production use by an internal team.
Cheers!
1 Like
Edward
December 26, 2022, 6:37am
4
Hey!
Streamlit is great.
I would like to suggest an enhancement to the JSON collapse option.
A very common situation is where you have
{
Header1: {...}
Header2: {...}
...
Header10: {...}
}
Right now expanded=False ==>
{...}
which is less than useful. First step is almost always to expand the first level.
In a situation like this it would be ideal if we could set the default to display level 1, but collapse the sub-dictionaries.
Instead of a simple boolean expanded option, it would be great if we could instead (or in addition) have a ‘levels’ argument. We display upto that level, and collapse anything deeper.