Decode a JSON string and inflate a node instance.
167992
def from_json(cls, data):
        """"""
        # Decode JSON string
        assert isinstance(data, str)
        data = json.loads(data)
        assert isinstance(data, dict)
        return cls.from_dict(data)
330678
def fromJSON(value):
        
        j = json.loads(value)
        v = GPString()
        if "defaultValue" in j:
            v.value = j['defaultValue']
        else:
            v.value = j['value']
        if 'paramName' in j:
            v.paramName = j['paramName']
        elif 'name' in j:
            v.paramName = j['name']
        return v
826371
public static JsonNode parse(final String jsonString) {
        if (Strings.isEmpty(jsonString)) {
            return newObject();
        }

        try {
            return createObjectMapper().readValue(jsonString, JsonNode.class);
        } catch (Throwable e) {
            throw new ParseException(String.format("can't parse string [%s]", jsonString), e);
        }
    }
582792
def fromJSON(value):
        """"""
        if isinstance(value, str):
            value = json.loads(value)
        elif isinstance(value, dict): pass
        else:
            raise AttributeError("Invalid input")
        return Extension(typeName=value['typeName'],
                         capabilities=value['capabilities'],
                         enabled=value['enabled'] == "true",
                         maxUploadFileSize=value['maxUploadFileSize'],
                         allowedUploadFileType=value['allowedUploadFileTypes'],
                         properties=value['properties'])
844915
def from_json(cls, json):
    
    return cls(
        namespace_range.NamespaceRange.from_json_object(
            json[cls.NAMESPACE_RANGE_PARAM]),
        json[cls.BATCH_SIZE_PARAM])
80604
def fromJSON(value):
        
        j = json.loads(value)
        v = GPMultiValue(gptype=j['dataType'])
        if "defaultValue" in j:
            v.value = j['defaultValue']
        else:
            v.value = j['value']
        if 'paramName' in j:
            v.paramName = j['paramName']
        elif 'name' in j:
            v.paramName = j['name']
        return v
1372297
def from_json(cls, json_doc):
        """"""
        try:
            d = json.load(json_doc)
        except AttributeError:  # catch the read() error
            d = json.loads(json_doc)

        return cls.from_dict(d)
1208573
def from_jsonld(cls, data, __reference__=None, __source__=None):
        """"""
        if isinstance(data, cls):
            return data

        if not isinstance(data, dict):
            raise ValueError(data)

        if '@type' in data:
            type_ = tuple(sorted(data['@type']))
            if type_ in cls.__type_registry__ and getattr(
                cls, '_jsonld_type', None
            ) != type_:
                new_cls = cls.__type_registry__[type_]
                if cls != new_cls:
                    return new_cls.from_jsonld(data)

        if cls._jsonld_translate:
            data = ld.compact(data, {'@context': cls._jsonld_translate})
            data.pop('@context', None)

        data.setdefault('@context', cls._jsonld_context)

        if data['@context'] != cls._jsonld_context:
            compacted = ld.compact(data, {'@context': cls._jsonld_context})
        else:
            compacted = data

        # assert compacted['@type'] == cls._jsonld_type, '@type must be equal'
        # TODO update self(not cls)._jsonld_context with data['@context']
        fields = cls._jsonld_fields

        if __reference__:
            with with_reference(__reference__):
                self = cls(
                    **{
                        k.lstrip('_'): v
                        for k, v in compacted.items() if k in fields
                    }
                )
        else:
            self = cls(
                **{
                    k.lstrip('_'): v
                    for k, v in compacted.items() if k in fields
                }
            )
        if __source__:
            setattr(self, '__source__', __source__)
        return self
790092
def get_python_json(scala_json):
    """"""
    def convert_node(node):
        if node.__class__.__name__ in ('org.json4s.JsonAST$JValue',
                                       'org.json4s.JsonAST$JObject'):
            # Make a dictionary and then convert each value
            values_raw = get_python_dict(node.values())
            values = {}
            for k, v in values_raw.items():
                values[k] = convert_node(v)
            return values
        elif node.__class__.__name__.startswith('scala.collection.immutable.Map') or \
            node.__class__.__name__ == \
                'scala.collection.immutable.HashMap$HashTrieMap':
            values_raw = get_python_dict(node)
            values = {}
            for k, v in values_raw.items():
                values[k] = convert_node(v)
            return values
        elif node.__class__.__name__ == 'org.json4s.JsonAST$JArray':
            entries_raw = get_python_list(node.values())
            entries = []
            for entry in entries_raw:
                entries.append(convert_node(entry))
            return entries
        elif node.__class__.__name__ == 'scala.collection.immutable.$colon$colon':
            entries_raw = get_python_list(node)
            entries = []
            for entry in entries_raw:
                entries.append(convert_node(entry))
            return entries
        elif node.__class__.__name__ == 'scala.math.BigInt':
            return node.intValue()
        elif node.__class__.__name__ == 'scala.None$':
            return None
        elif node.__class__.__name__ == 'scala.collection.immutable.Nil$':
            return []
        elif isinstance(node, (str, int, float)):
            return node
        else:
            logger.error('Cannot convert %s into Python' %
                         node.__class__.__name__)
            return node.__class__.__name__

    python_json = convert_node(scala_json)
    return python_json
441322
private static JsonNode toJson(AggregatedHttpMessage res, @Nullable JsonNodeType expectedNodeType) {
        final String content = toString(res);
        final JsonNode node;
        try {
            node = Jackson.readTree(content);
        } catch (JsonParseException e) {
            throw new CentralDogmaException("failed to parse the response JSON", e);
        }

        if (expectedNodeType != null && node.getNodeType() != expectedNodeType) {
            throw new CentralDogmaException(
                    "invalid server response; expected: " + expectedNodeType +
                    ", actual: " + node.getNodeType() + ", content: " + content);
        }
        return node;
    }
535384
def _load_from_string(data):
    ''''''
    global _CACHE
    if PYTHON_3:
        data = json.loads(data.decode("utf-8"))
    else:
        data = json.loads(data)
    _CACHE = _recursively_convert_unicode_to_str(data)['data']
749228
def from_json(cls, json_dump):
        
        context = cls()
        if json_dump is None:
            return None
        ctxt = json.loads(json_dump)
        for k in ctxt:
            context[k] = ctxt[k]
        return context
469298
def fromJSON(value):
        
        j = json.loads(value)
        v = GPLinearUnit()
        if "defaultValue" in j:
            v.value = j['defaultValue']
        else:
            v.value = j['value']
        if 'paramName' in j:
            v.paramName = j['paramName']
        elif 'name' in j:
            v.paramName = j['name']
        return v
659279
def from_json(cls, data, json_schema_class=None):
        
        schema = cls.json_schema if json_schema_class is None else json_schema_class()
        return schema.load(data)
820058
def string2json(self, string):
        """"""
        kwargs = {
            'cls': BytesEncoder,  # use the IPython bytes encoder
            'indent': 1,
            'sort_keys': True,
            'separators': (',', ': '),
        }
        return cast_unicode(json.dumps(string, **kwargs), 'utf-8')
1344145
def loads(cls, str):
        
        d = json.loads(str)
        return cls.create(d)
750362
def from_json(cls, key):
        
        obj = cls()
        try:
            jkey = json_decode(key)
        except Exception as e:  # pylint: disable=broad-except
            raise InvalidJWKValue(e)
        obj.import_key(**jkey)
        return obj