code: def default(self, path_spec_object):
      
      if not isinstance(path_spec_object, path_spec.PathSpec):
        raise TypeError
  
      json_dict = {'__type__': 'PathSpec'}
      for property_name in path_spec_factory.Factory.PROPERTY_NAMES:
        property_value = getattr(path_spec_object, property_name, None)
        if property_value is not None:
          # Convert row_condition tuple to a list
          if property_name == 'row_condition':
            json_dict[property_name] = list(property_value)
          else:
            json_dict[property_name] = property_value
  
      if path_spec_object.HasParent():
        json_dict['parent'] = self.default(path_spec_object.parent)
  
      json_dict['type_indicator'] = path_spec_object.type_indicator
      location = getattr(path_spec_object, 'location', None)
      if location:
        json_dict['location'] = location
  
      return json_dict
docs: Converts a path specification object into a JSON dictionary.
  
      The resulting dictionary of the JSON serialized objects consists of:
      {
          '__type__': 'PathSpec'
          'type_indicator': 'OS'
          'parent': { ... }
          ...
      }
  
      Here '__type__' indicates the object base type in this case this should
      be 'PathSpec'. The rest of the elements of the dictionary make up the
      path specification object properties. The supported property names are
      defined in path_spec_factory.Factory.PROPERTY_NAMES. Note that this method
      is called recursively for every path specification object and creates
      a dict of dicts in the process that is transformed into a JSON string
      by the JSON encoder.
  
      Args:
        path_spec_object (PathSpec): a path specification.
  
      Returns:
        dict[str, object]: JSON serialized objects.
  
      Raises:
        TypeError: if not an instance of PathSpec.