Create :class:`.resources.Entry` from JSON.

        :param json: JSON dict.
        :return: Entry instance.
184335
def create_entry(self, json):
        
        sys = json['sys']
        ct = sys['contentType']['sys']['id']
        fields = json['fields']
        raw_fields = copy.deepcopy(fields)

        # Replace links with :class:`.resources.ResourceLink` objects.
        for k, v in fields.items():
            link = ResourceFactory._extract_link(v)
            if link is not None:
                fields[k] = link
            elif isinstance(v, list):
                for idx, ele in enumerate(v):
                    link = ResourceFactory._extract_link(ele)
                    if link is not None:
                        v[idx] = link

        if ct in self.entries_mapping:
            clazz = self.entries_mapping[ct]
            result = clazz()

            for k, v in clazz.__entry_fields__.items():
                field_value = fields.get(v.field_id)
                if field_value is not None:
                    setattr(result, k, ResourceFactory.convert_value(field_value, v))
        else:
            result = Entry()

        result.sys = sys
        result.fields = fields
        result.raw_fields = raw_fields

        return result
17344
def _fromJSON(cls, jsonobject):
        
        newInstance = cls(jsonobject[0], jsonobject[1])
        attribDict = {}
        attribDict['dataProcessingRef'] = jsonobject[2]
        attribDict['precursor'] = jsonobject[3]
        attribDict['product'] = jsonobject[4]
        attribDict['params'] = [tuple(param) for param in jsonobject[5]]
        attribDict['attrib'] = jsonobject[6]
        attribDict['arrayInfo'] = dict()
        for arrayType, jsonEntry in viewitems(jsonobject[7]):
            arrayEntry = {'dataProcessingRef': jsonEntry['dataProcessingRef'],
                          'params': [tuple(_) for _ in jsonEntry['params']]
                          }
            attribDict['arrayInfo'][arrayType] = arrayEntry
        for key, value in viewitems(attribDict):
            setattr(newInstance, key, value)
        return newInstance
1131998
def instantiate_references_json(references_json):
    ''' 

    '''

    # Create all instances, but without setting their props
    references = {}
    for obj in references_json:
        obj_id = obj['id']
        obj_type = obj.get('subtype', obj['type'])

        cls = get_class(obj_type)
        instance = cls.__new__(cls, id=obj_id)
        if instance is None:
            raise RuntimeError('Error loading model from JSON (type: %s, id: %s)' % (obj_type, obj_id))
        references[instance.id] = instance

    return references
416915
def _create_json(self):
        
        data_json = {
            "name": self.name,
            "includesPattern": self.includesPattern,
            "excludesPattern": self.excludesPattern,
            "repositories": self._repositories,
            "principals": {
                'users': self._users,
                'groups': self._groups,
            }
        }
        return data_json
512368
def from_json_file(cls, file_name):
        
        with open(file_name) as json_data:
            config = json.load(json_data)

        return cls(config)
514807
public Map<String, Object> fromJson(String json) throws IOException {
    if (json == null) {
      throw new IllegalArgumentException("json == null");
    }
    if (json.length() == 0) {
      throw new IllegalArgumentException("json empty");
    }
    return fromJson(new StringReader(json));
  }
881700
public static BaseBo fromJson(String json, ClassLoader classLoader) {
        return fromJson(json, BaseBo.class, classLoader);
    }
1101601
def create_from_json(cls, json_data):
        
        block = Block()
        block_info = json_data["block_info"]
        block.block_id = block_info["block_id"]
        block.num_bins = block_info["num_bins"] if "num_bins" in block_info else None
        block.property_type = block_info["property_type"] if "property_type" in block_info else None
        block.meta = json_data["meta"] if "meta" in json_data else None

        block.component_results = _create_component_results(json_data, "block_info")

        return block
1361690
def from_json(cls, json_obj):
        
        if isinstance(json_obj, str):
            json_obj = json.loads(json_obj)

        type = None
        time = None
        data = None
        if cls.TYPE_FIELD_NAME in json_obj:
            type = json_obj[cls.TYPE_FIELD_NAME]

        if cls.TIME_FIELD_NAME in json_obj:
            time = json_obj[cls.TIME_FIELD_NAME]
        else:
            raise InvalidEventError("{field} must be present!".format(
                field=cls.TIME_FIELD_NAME))

        if cls.DATA_FIELD_NAME in json_obj:
            data = json_obj[cls.DATA_FIELD_NAME]

        return cls(type, time, data)
646726
public static Credentials createFromJson( String json )
    {
        JSONObject jsonObj = ( JSONObject ) new JSONTokener( json ).nextValue();

        if ( jsonObj.has( PasswordCredentials.PASSWORD ) ) {
            // Password credentials
            return PasswordCredentials.fromJson( jsonObj );
        } else {
            // OAuth2 credentials
            return OAuth2Credentials.fromJson( jsonObj );
        }
    }
743720
def _fromJSON(cls, jsonobject):
        
        newInstance = cls(None, None)
        newInstance.__dict__.update(jsonobject)
        return newInstance
1116748
def from_json(self, json, models=None):
        ''' 
        '''
        if json is None:
            return None
        elif not isinstance(json, dict):
            raise DeserializationError("%s expected a dict or None, got %s" % (self, json))
        new_data = {}
        for key, value in json.items():
            key = self.keys_type.from_json(key, models)
            if isinstance(value, dict) and '__ndarray__' in value:
                new_data[key] = decode_base64_dict(value)
            elif isinstance(value, list) and any(isinstance(el, dict) and '__ndarray__' in el for el in value):
                new_list = []
                for el in value:
                    if isinstance(el, dict) and '__ndarray__' in el:
                        el = decode_base64_dict(el)
                    elif isinstance(el, list):
                        el = self.values_type.from_json(el)
                    new_list.append(el)
                new_data[key] = new_list
            else:
                new_data[key] = self.values_type.from_json(value, models)
        return new_data
450432
def read_json(json_metadata):
        
        # Load the metadata object from the file
        with open(json_metadata) as metadatareport:
            jsondata = json.load(metadatareport)
        # Create the metadata objects
        metadata = MetadataObject()
        # Initialise the metadata categories as GenObjects created using the appropriate key
        for attr in jsondata:
            if not isinstance(jsondata[attr], dict):
                setattr(metadata, attr, jsondata[attr])
            else:
                setattr(metadata, attr, GenObject(jsondata[attr]))
        return metadata
821564
def from_json(self, fname):
        '''
            
        '''
        with open(fname, 'rt') as fp:
            for row in json.load(fp):
                nn = ServerInfo.from_dict(row)
                self[str(nn)] = nn
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
718214
def from_json(cls, json_string):
        
        input_dict = json.loads(json_string)
        # convert index to tuple if required
        if input_dict['index'] and isinstance(input_dict['index'][0], list):
            input_dict['index'] = [tuple(x) for x in input_dict['index']]
        # convert index_name to tuple if required
        if isinstance(input_dict['meta_data']['index_name'], list):
            input_dict['meta_data']['index_name'] = tuple(input_dict['meta_data']['index_name'])
        data = input_dict['data'] if input_dict['data'] else None
        return cls(data=data, index=input_dict['index'], **input_dict['meta_data'])
75760
def create_array(self, json):
        
        result = Array(json['sys'])
        result.total = json['total']
        result.skip = json['skip']
        result.limit = json['limit']
        result.items = []
        result.items_mapped = {'Asset': {}, 'Entry': {}}

        self.process_array_items(result, json)
        self.process_array_includes(result, json)

        return result