json_editor_documentation.py 476 B

1234567891011121314151617
  1. from nicegui import ui
  2. def main_demo() -> None:
  3. json = {
  4. 'array': [1, 2, 3],
  5. 'boolean': True,
  6. 'color': '#82b92c',
  7. None: None,
  8. 'number': 123,
  9. 'object': {'a': 'b', 'c': 'd'},
  10. 'time': 1575599819000,
  11. 'string': 'Hello World'
  12. }
  13. ui.json_editor({'content': {'json': json}},
  14. on_select=lambda e: ui.notify(f'Select: {e}'),
  15. on_change=lambda e: ui.notify(f'Change: {e}'))