class_docstr: Encoder class for json encoding Metric Object
docstr: Override only when object is of type Metric
docstr_tok: ["Override","only","when","object","is","of","type","Metric"]
code: def default(
      self, obj
  ):  # pylint: disable=arguments-differ, method-hidden
      """
      Override only when object is of type Metric
      """
      if isinstance(obj, (Metric, Dimension)):
          return obj.to_dict()
      return json.JSONEncoder.default(self, obj)
  
imports: import json
  from json import JSONEncoder
  from ts.metrics.dimension import Dimension
  from ts.metrics.metric import Metric
label_desc: Use image node_id 1 for calling the MetricEncoder obj's underlying member method code with example usage: obj.default(obj) and returns: json, obj