Hi! I have trouble with serialization html.div as a json. I want to export page (where is assigned html.div) to json and save it. Then I want to regenerate page with the same html. Method to_plotly_json generates bad json:
{‘namespace’: ‘dash_html_components’, ‘type’: ‘Div’, ‘props’: {‘children’: [H1(children=‘This’, role=‘a role’), H2(‘is’), H3(‘a page’), Textarea(value=‘Textarea1’), Div([H4(‘Div with textarea!’)])]}}
(lack of ’ ’ after 'props;). Could someone help me?
class Tab():
def __init__(self,name):
self.name= name
self.page = html.Div(
[
html.H1('This',role="a role"),
html.H2('is'),
html.H3('a page'),
dcc.Textarea(value='Textarea1'),
html.Div([html.H4('Div with textarea!')])
]
)
def dumpJson(self):
el_list=str(self.page.to_plotly_json())
f = open(env.json_save_path,"w")
f.write(el_list)
f.close()