When returning a python list to a gr.json() object it does not properly format it. See how it introduces a pseudo key-value appearing structure within the square bracers of the list. Peculiarly, when one clicks the "Copy" button on the gr.json() object, properly formatted json is copied as shown below! It appears to be solely a visual artefact.
[
{
"match_ordinal": "1",
"match_score": "99",
"org_name": "JP Morgan Securities plc (Frankfurt am Main Branch)",
"org_perm_id": "5001223099",
"uuid": "1"
}
]
Have you searched existing issues? 🔎
[X] I have searched and found no existing issues
Reproduction
import gradio as gr
with gr.Blocks() as demo:
text_output = gr.Text()
json_output = gr.JSON()
def return_list():
my_list = [{"some": "data"}]
return my_list, my_list
demo.load(return_list, inputs=None, outputs=[text_output, json_output])
Describe the bug
When returning a python list to a gr.json() object it does not properly format it. See how it introduces a pseudo key-value appearing structure within the square bracers of the list. Peculiarly, when one clicks the "Copy" button on the gr.json() object, properly formatted json is copied as shown below! It appears to be solely a visual artefact.
Have you searched existing issues? 🔎
Reproduction
Screenshot
Logs
System Info
Severity
I can work around it