How to serialize Json file of Html.Div?

Following the tutorial of https://dash.plotly.com/sharing-data-between-callbacks,
I am trying to store a result into a hidden Div. For example:

x = html.Div([dcc.Graph(id = 1), ], style={"border":"1px black solid"})
new_x = (json.dumps(x))

This will throw error of object is not serializable. Is there an easy way to convert everything into String and back? Or do I have to store the data as list only and create the graphs later?

After some playing around, it seems hard to convert everything in Json in one go. The best solution is to store the intermediate result in a hidden Div and use call backs to initialize from there.