class_docstr: Frontend UI layout; should match client/lib/types.ts.
docstr: Override serialization to properly convert nested objects.
docstr_tok: ["Override","serialization","to","properly","convert","nested","objects","."]
code: def to_json(self) -> dtypes.JsonDict:
      """Override serialization to properly convert nested objects."""
      # Not invertible, but these only go from server -> frontend anyway.
      return attr.asdict(self, recurse=True)
  
file_path: lit/lit_nlp/api/layout.py
imports: from collections.abc import Mapping, Sequence
  import enum
  from typing import Optional, Union
  import attr
  from lit_nlp.api import dtypes
label_desc: Use image node_id 1 for calling the LitCanonicalLayout obj's underlying member method code with example usage: obj.to_json() and returns: attr