code: def to_json(renderer, split: bool = False) -> List[Dict]:
      if renderer.TYPE == "vega":
          if not renderer.datapoints:
              return []
          revs = renderer.get_revs()
          if split:
              (
                  content,
                  split_content,
              ) = renderer.get_partial_filled_template()
          else:
              content = renderer.get_filled_template()
              split_content = {}
  
          return [
              {
                  TYPE_KEY: renderer.TYPE,
                  REVISIONS: revs,
                  "content": content,
                  **split_content,
              }
          ]
      if renderer.TYPE == "image":
          return [
              {
                  TYPE_KEY: renderer.TYPE,
                  REVISIONS: [datapoint.get(REVISION)],
                  "url": datapoint.get(SRC),
              }
              for datapoint in renderer.datapoints
          ]
      raise ValueError(f"Invalid renderer: {renderer.TYPE}")
  
imports: from typing import Dict, List, Union
  from dvc.render import REVISION, REVISIONS, SRC, TYPE_KEY
  from dvc.render.converter.image import ImageConverter
  from dvc.render.converter.vega import VegaConverter
label_desc: Use image node_id 2 for calling a global function with example usage: to_json(renderer, split) and returns: list, unknown, list