code: def _read_data(path):
      """Read Rdump or JSON output to dictionary.
  
      Parameters
      ----------
      path : str
  
      Returns
      -------
      Dict
          key, values pairs from Rdump/JSON formatted data.
      """
      data = {}
      with open(path, "r", encoding="utf8") as f_obj:
          if path.lower().endswith(".json"):
              return json.load(f_obj)
          var = ""
          for line in f_obj:
              if "<-" in line:
                  if len(var):
                      key, var = _process_data_var(var)
                      data[key] = var
                  var = ""
              var += f" {line.strip()}"
          if len(var):
              key, var = _process_data_var(var)
              data[key] = var
      return data
  
imports: import logging
  import os
  import re
  from collections import defaultdict
  from glob import glob
  from pathlib import Path
  from typing import Dict, List, Optional, Union
  import numpy
  from ..None import utils
  from ..rcparams import rcParams
  from .base import CoordSpec, DimSpec, dict_to_dataset, infer_stan_dtypes, requires
  from .inference_data import InferenceData
label_desc: Use image node_id 6 for calling a global function with example usage: _read_data(path) and returns: data, json