forked from streamlit/streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow configurable expansion depth for
st.json
(streamlit#8984)
## Describe your changes Allows users to specify the depth to which the JSON element should be expanded, collapsing deeper levels. ```python data = { "level_1": { "level_2": { "level_3a": { "item1": "value1", "item2": "value2", }, "level_3b": { "item3": "value3", "level_4": { "item4": "value4", "level_5": { "item5": "value5" } } } }, "simple_item": "simple_value" }, "top_level_item": "top_level_value" } st.json(data) # Default expands all nodes (to max depth). Same behavior as today st.json(data, expanded=True) # Same as above st.json(data, expanded=False) # Collapses all nodes. Same behavior as today st.json(data, expanded=0) # Collapses all nodes. Same as expanded=False ``` ## GitHub Issue Link (if applicable) - Closes: streamlit#8825 ## Testing Plan - Added unit and e2e tests. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
- Loading branch information
1 parent
00e115c
commit 5e2a908
Showing
10 changed files
with
72 additions
and
19 deletions.
There are no files selected for viewing
Binary file modified
BIN
-2 Bytes
(100%)
e2e_playwright/__snapshots__/linux/st_json_test/st_json-empty_dict[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.65 KB
e2e_playwright/__snapshots__/linux/st_json_test/st_json-expanded_2[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.8 KB
e2e_playwright/__snapshots__/linux/st_json_test/st_json-expanded_2[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.79 KB
e2e_playwright/__snapshots__/linux/st_json_test/st_json-expanded_2[webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters