code: def write_json(  # noqa: PLR0913
      self,
      data: Any,
      indent: Optional[int] = None,
      highlight: Optional[bool] = None,
      stderr: bool = False,
      skip_keys: bool = False,
      ensure_ascii: bool = True,
      check_circular: bool = True,
      allow_nan: bool = True,
      default: Optional[Callable[[Any], Any]] = None,
      sort_keys: bool = False,
  ) -> None:
      if highlight is None:
          highlight = self.isatty()
      if indent is None and self.isatty():
          indent = 2
  
      from rich.json import JSON
  
      json = JSON.from_data(
          data=data,
          indent=indent,
          highlight=bool(highlight),
          skip_keys=skip_keys,
          ensure_ascii=ensure_ascii,
          check_circular=check_circular,
          allow_nan=allow_nan,
          default=default,
          sort_keys=sort_keys,
      )
      if not highlight:
          import os
  
          # we don't need colorama to try to strip ansi codes
          # when highlighting is disabled
          ctx = (
              nullcontext()
              if "DVC_TEST" in os.environ
              else disable_colorama()
          )
          with ctx:
              return self.write(json.text, stderr=stderr)
      return self.rich_print(json, stderr=stderr, soft_wrap=True)
  
imports: from contextlib import contextmanager, nullcontext
  from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, Optional, Sequence, TextIO, Type, Union
  import colorama
  from dvc.utils.objects import cached_property
label_desc: Use image node_id 7 for calling the Console obj's underlying member method code with example usage: obj.write_json(data, indent, highlight, stderr, skip_keys, ensure_ascii, check_circular, allow_nan, default, sort_keys) and returns: self, self