json_editor_documentation.py 512 B

1234567891011121314151617181920
  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': {
  10. 'a': 'b',
  11. 'c': 'd',
  12. },
  13. 'time': 1575599819000,
  14. 'string': 'Hello World',
  15. }
  16. ui.json_editor({'content': {'json': json}},
  17. on_select=lambda e: ui.notify(f'Select: {e}'),
  18. on_change=lambda e: ui.notify(f'Change: {e}'))