Spaces:
Sleeping
Sleeping
File size: 635 Bytes
65dac95 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import streamlit as st
import pandas as pd
import json
# Title of the app
st.title('Gen AI Jam JSON Visualizer')
# File uploader widget
uploaded_file = st.file_uploader("Choose a JSON file", type=['json'])
if uploaded_file is not None:
# Reading the file
file_data = json.load(uploaded_file)
# If the JSON is deeply nested, you may need to normalize it to create a flat table
if isinstance(file_data, list): # Assuming the JSON is an array of records
df = pd.json_normalize(file_data)
else:
df = pd.json_normalize(file_data, max_level=1)
# Display the dataframe as a table
st.write(df)
|