code: def test_stda002_nested_data(dash_dcc):
      app = Dash(__name__)
  
      nested = {"nested": {"nest": "much"}}
      nested_list = dict(my_list=[1, 2, 3])
  
      app.layout = html.Div(
          [
              dcc.Store(id="store", storage_type="local"),
              html.Button("set object as key", id="obj-btn"),
              html.Button("set list as key", id="list-btn"),
              html.Output(id="output"),
          ]
      )
  
      @app.callback(
          Output("store", "data"),
          [
              Input("obj-btn", "n_clicks_timestamp"),
              Input("list-btn", "n_clicks_timestamp"),
          ],
      )
      def on_obj_click(obj_ts, list_ts):
          if obj_ts is None and list_ts is None:
              raise PreventUpdate
  
          # python 3 got the default props bug. plotly/dash#396
          if (obj_ts and not list_ts) or obj_ts > list_ts:
              return nested
          else:
              return nested_list
  
      @app.callback(
          Output("output", "children"),
          [Input("store", "modified_timestamp")],
          [State("store", "data")],
      )
      def on_ts(ts, data):
          if ts is None:
              raise PreventUpdate
          return json.dumps(data)
  
      dash_dcc.start_server(app)
  
      obj_btn = dash_dcc.wait_for_element("#obj-btn")
      list_btn = dash_dcc.find_element("#list-btn")
  
      obj_btn.click()
      dash_dcc.wait_for_text_to_equal("#output", json.dumps(nested))
      # it would of crashed the app before adding the recursive check.
  
      list_btn.click()
      dash_dcc.wait_for_text_to_equal(
          "#output", json.dumps(nested_list)
      )
  
      assert dash_dcc.get_logs() == []
  
file_path: dash/components/dash-core-components/tests/integration/store/test_store_data.py
imports: import sys
  import json
  import hashlib
  import itertools
  import pytest
  from dash import Dash, Input, Output, State, dcc, html
  from dash.exceptions import PreventUpdate
label_desc: Use image node_id 2 for calling a global function with example usage: test_stda002_nested_data(dash_dcc) and returns: json, nested, nested_list