Returns a JSON serializable represenation of a ``Smi`` class
        instance. Use :func:`maspy.core.Sai._fromJSON()` to generate a new
        ``Smi`` instance from the return value.

        :returns: a JSON serializable python object
356073
def _reprJSON(self):
        
        return {'__Smi__': (self.id, self.specfile, self.attributes,
                            self.params, self.scanListParams, self.scanList,
                            self.precursorList, self.productList
                            )
                }
737477
def from_json(cls, s):
        
        d = json.loads(s)
        return get_dict_handler(d["type"])(d)
1137418
def json(self, *,  # type: ignore
             loads: Callable[[Any], Any]=json.loads) -> None:
        
        return loads(self.data)
154087
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        return value or default
886137
def json_to_class(cls, json_str):
    

    obj_raw = json.loads(json_str)

    return deserialize(cls, obj_raw)
234239
def json_repr(obj):
    

    def serialize(obj):
        """Recursively walk object's hierarchy.
        """
        if obj is None:
            return None
        if isinstance(obj, Enum):
            return str(obj)
        if isinstance(obj, (bool, int, float, str)):
            return obj
        if isinstance(obj, dict):
            obj = obj.copy()
            for key in sorted(obj.keys()):
                obj[key] = serialize(obj[key])
            return obj
        if isinstance(obj, list):
            return [serialize(item) for item in obj]
        if isinstance(obj, tuple):
            return tuple(serialize([item for item in obj]))
        if hasattr(obj, '__dict__'):
            return serialize(obj.__dict__)
        return repr(obj)

    return json.dumps(serialize(obj))
1163968
def from_json(s):
    
    d = json.loads(s)
    sbp = SBP.from_json_dict(d)
    return sbp
230060
def to_json(self):
    
    # Use the member variable (since we don't have access to the context) to
    # flush each pool to minimize the size of each filehandle before we
    # serialize it.
    for pool in self._pools:
      if pool is not None:
        pool.flush(True)
    return {"filehandles": pickle.dumps(self._filehandles)}
823684
def _fromJSON(cls, jsonobject):
        
        newInstance = cls(None, None)
        attribDict = {}
        attribDict['id'] = jsonobject[0]
        attribDict['specfile'] = jsonobject[1]
        attribDict['attributes'] = jsonobject[2]
        attribDict['params'] = [tuple(param) for param in jsonobject[3]]
        attribDict['scanListParams'] = [tuple(param) for param in jsonobject[4]]
        attribDict['scanList'] = jsonobject[5]
        attribDict['precursorList'] = jsonobject[6]
        attribDict['productList'] = jsonobject[7]
        for key, value in viewitems(attribDict):
            setattr(newInstance, key, value)
        return newInstance
889342
def to_json(self):
        
        json_dict = {'keyboard': self.keyboard}
        if self.one_time_keyboard:
            json_dict['one_time_keyboard'] = True

        if self.resize_keyboard:
            json_dict['resize_keyboard'] = True

        if self.selective:
            json_dict['selective'] = True

        return json.dumps(json_dict)
151748
def _fromJSON(cls, jsonobject):
        
        newInstance = cls(jsonobject[0], jsonobject[1])
        for arrayType, jsonEntry in viewitems(jsonobject[2]):
            arrayEntry = {'dataProcessingRef': jsonEntry['dataProcessingRef'],
                          'params': [tuple(_) for _ in jsonEntry['params']]
                          }
            newInstance.arrayInfo[arrayType] = arrayEntry

        return newInstance
1054931
def to_json(self):
        

        result = {
            'sys': {}
        }
        for k, v in self.sys.items():
            if k in ['space', 'content_type', 'created_by',
                     'updated_by', 'published_by']:
                v = v.to_json()
            if k in ['created_at', 'updated_at', 'deleted_at',
                     'first_published_at', 'published_at', 'expires_at']:
                v = v.isoformat()
            result['sys'][camel_case(k)] = v

        return result
213362
def export_to_json(self):
        

        return {
            hostname: sorted(self._encode_key(key) for key in pins)
            for hostname, pins in self._storage.items()
        }
1052950
def to_dict(self) -> Dict[str, Any]:
        
        jsn = {
            'kind': self.__class__.__name__,
            'message': self.message
        } # type: Dict[str, Any]
        data = self.data
        if data:
            jsn['data'] = data
        jsn = {'error': jsn}
        return jsn
329955
def to_json(self, **kwargs: Mapping) -> str:
        
        content = {
            'Header': dict(self.Header),
            'Reads': self.Reads,
            'Settings': dict(self.Settings),
            'Data': [sample.to_json() for sample in self.samples],
            **{title: dict(getattr(self, title)) for title in self._sections},
        }
        return json.dumps(content, **kwargs)
888301
def json_repr(self, minimal=False):
        
        if self.value:
            return [self.field, self.operator, self.value]
        else:
            return [self.field, self.operator]
158774
def to_dict(self, serialize=False):
        
        if serialize:
            encode_method = json_encode_for_zendesk
        else:
            encode_method = json_encode_for_printing
        return json.loads(json.dumps(self._to_dict(serialize=serialize), default=encode_method))