All
Go
Java
Javascript
Php
Python
Ruby
1.
JCloudYu/beson · deserialize.esm.js
Match rating: 67.92% · See similar code snippets
javascript logo
function __deserializeArray(buffer, start, options) {
	let dataView = new DataView(buffer);
	let length = dataView.getUint32(start, true);
	start += 4;
	let end = start + length;
	let data = [];
	while (start < end) {
		let subType, subData;
		({ anchor: start, value: subType } = __deserializeType(buffer, start, options));
		({ anchor: start, value: subData } = __deserializeData(subType, buffer, start, options));
		data.push(subData);
	}
	return { anchor: end, value: data };
}
2.
JCloudYu/beson · deserialize.esm.js
Match rating: 67.77% · See similar code snippets
javascript logo
function __deserializeObject(buffer, start, options) {
	let dataView = new DataView(buffer);
	let length = dataView.getUint32(start, true);
	start += 4;
	let end = start + length;
	let data = {};
	while (start < end) {
		let subType, subKey, subData;
		({ anchor: start, value: subType } = __deserializeType(buffer, start, options));
		({ anchor: start, value: subKey } = __deserializeShortString(buffer, start, options));
		({ anchor: start, value: subData } = __deserializeData(subType, buffer, start, options));
		data[subKey] = subData;
	}
	return { anchor: end, value: data };
}
3.
Azure/azure-sdk-for-ruby · jsonable.rb
Match rating: 67.49% · See similar code snippets
ruby logo
def from_json(json, mapper = nil)
      mapper = self.class.mapper if mapper.nil?
      deserialize(mapper, json)
    end
4.
JCloudYu/beson · deserialize.esm.js
Match rating: 66.57% · See similar code snippets
javascript logo
function __deserializeObjectStreaming(buffer, start, options) {
	let end = start;
	let dataView = new DataView(buffer);
	let endData = new Uint16Array(TYPE_HEADER.OBJECT_END);
	let data = {};
	while (start < buffer.byteLength) {
		let tmpType = dataView.getUint16(start, true);
		if (tmpType === endData[0]) {
			end += 2;
			break;
		}

		let subType, subKey, subData;
		({ anchor: start, value: subType } = __deserializeType(buffer, start, options));
		({ anchor: start, value: subKey } = __deserializeShortString(buffer, start, options));
		({ anchor: start, value: subData } = __deserializeData(subType, buffer, start, options));
		data[subKey] = subData;
		end = start;
	}
	return { anchor: end, value: data };
}
5.
JCloudYu/beson · deserialize.esm.js
Match rating: 65.9% · See similar code snippets
javascript logo
function __deserializeContent(buffer, start, options) {
	let type, data;
	({ anchor: start, value: type } = __deserializeType(buffer, start, options));
	({ anchor: start, value: data } = __deserializeData(type, buffer, start, options));
	return { anchor: start, value: data };
}
6.
JCloudYu/beson · deserialize.esm.js
Match rating: 65.33% · See similar code snippets
javascript logo
function __deserializeArrayStreaming(buffer, start, options) {
	let end = start;
	let dataView = new DataView(buffer);
	let endData = new Uint16Array(TYPE_HEADER.ARRAY_END);
	let data = [];
	while (start < buffer.byteLength) {
		let tmpType = dataView.getUint16(start, true);
		if (tmpType === endData[0]) {
			end += 2;
			break;
		}
		
		let subType, subData;
		({ anchor: start, value: subType } = __deserializeType(buffer, start, options));
		({ anchor: start, value: subData } = __deserializeData(subType, buffer, start, options));
		data.push(subData);
		end = start;
	}
	return { anchor: end, value: data };
}
7.
JCloudYu/beson · deserialize.esm.js
Match rating: 64.94% · See similar code snippets
javascript logo
function __deserializeInt8(buffer, start, options) {
	let end = start + 1;
	let dataView = new DataView(buffer);
	let data = dataView.getInt8(start);
	return { anchor: end, value:options.use_native_types ? data : Int8.from(data) };
}
8.
JCloudYu/beson · deserialize.esm.js
Match rating: 64.88% · See similar code snippets
javascript logo
function __deserializeDate(buffer, start, options) {
	let end = start + 8;
	let dataView = new DataView(buffer);
	let data = new Date(dataView.getFloat64(start, true));
	return { anchor: end, value: data };
}
9.
JCloudYu/beson · deserialize.esm.js
Match rating: 64.63% · See similar code snippets
javascript logo
function __deserializeInt32(buffer, start, options) {
	let end = start + 4;
	let dataView = new DataView(buffer);
	let data = dataView.getInt32(start, true);
	return { anchor: end, value:options.use_native_types ? data : Int32.from(data) };
}
10.
Match rating: 64.08% · See similar code snippets
php logo
public static function deserialize(string $json)
    {
        $deserialized = json_decode($json, true);
        $objects = [];

        return self::decode($deserialized, $objects);
    }
11.
Match rating: 63.9% · See similar code snippets
ruby logo
def deserialize(json)
      self.account = deserialize_account(json.try_path('accountStatement', 'info'))
      self.transactions = deserialize_transactions(json.try_path('accountStatement', 'transactionList', 'transaction'))
      self
    end
12.
JCloudYu/beson · deserialize.esm.js
Match rating: 61.78% · See similar code snippets
javascript logo
function __deserializeString(buffer, start, options) {
	let step = 1;
	let dataView = new DataView(buffer);
	let length = dataView.getUint32(start, true);
	start += 4;
	let end = start + length;
	let dataArray = [];
	for (let i = start; i < end; i += step) {
		dataArray.push(dataView.getUint8(i));
	}
	let data = UTF8Decode(Uint8Array.from(dataArray).buffer);
	return { anchor: end, value: data };
}
13.
chemisus/provider · JsonSerializer.php
Match rating: 61.28% · See similar code snippets
php logo
public function deserialize($string)
    {
        return json_decode($string, $this->deserializeAssoc, $this->deserializeDepth, $this->deserializeOptions);
    }
14.
JCloudYu/beson · deserialize.esm.js
Match rating: 61.12% · See similar code snippets
javascript logo
function __deserializeObjectId(buffer, start, options) {
	let step = 1;
	let length = 12;
	let end = start + length;
	let dataView = new DataView(buffer);
	let dataArray = [];
	for (let i = start; i < end; i += step) {
		dataArray.push(dataView.getUint8(i));
	}
	let data = new ObjectId(Uint8Array.from(dataArray).buffer);
	return { anchor: end, value: data };
}
15.
dropbox/dropbox-sdk-java · StoneSerializer.java
Match rating: 61.0% · See similar code snippets
java logo
public T deserialize(InputStream json) throws IOException, JsonParseException {
        JsonParser p = Util.JSON.createParser(json);
        p.nextToken();
        return deserialize(p);
    }
16.
duracloud/duracloud · JaxbJsonSerializer.java
Match rating: 60.82% · See similar code snippets
java logo
public T deserialize(String json) throws IOException {
        return (T) mapper.readValue(json, type);
    }
17.
sclasen/swfsm · fsm_models.go
Match rating: 60.79% · See similar code snippets
go logo
func (j JSONStateSerializer) Deserialize(serialized string, state interface{}) error {
	err := json.NewDecoder(strings.NewReader(serialized)).Decode(state)
	return err
}
18.
juju/juju · service.go
Match rating: 60.31% · See similar code snippets
go logo
func (s *Service) deserialize(data []byte) (common.Conf, error) {
	conf, err := deserialize(data, renderer)
	if err != nil {
		return conf, s.errorf(err, "failed to deserialize conf")
	}
	return conf, nil
}
19.
maximegosselin/serializer · Engine.php
Match rating: 60.27% · See similar code snippets
php logo
public function deserialize(array $data)
    {
        /** @var DeserializeStrategyInterface $strategy */
        foreach ($this->deserializeStrategies as $strategy) {
            if ($strategy->canDeserialize($data)) {
                return $strategy->deserialize($data);
            }
        }

        throw new DeserializationException('Could not deserialize data.');
    }
20.
martyn82/apha · SagaSerializer.php
Match rating: 60.21% · See similar code snippets
php logo
public function deserialize(string $data, string $type)
    {
        /* @var $deserialized Saga */
        $deserialized = $this->serializer->deserialize($data, $type);
        $this->factory->hydrate($deserialized);
        return $deserialized;
    }
21.
sergey-shandar/restapi-core-php-poc · TypeInfo.php
Match rating: 59.8% · See similar code snippets
php logo
public function jsonDeserialize($json)
    {
        return $json === null ? null : $this->deserialize(Common::decode($json));
    }
22.
maximegosselin/serializer · ArrayDeserializeStrategy.php
Match rating: 59.44% · See similar code snippets
php logo
public function deserialize(array $data)
    {
        $this->assertValidData($data);

        $payload = $data['payload'];
        $deserializer = $this->deserializer;
        array_walk($payload, function (&$value) use ($deserializer) {
            $value = $deserializer->deserialize($value);
        });

        return $payload;
    }
23.
gorilla/securecookie · securecookie.go
Match rating: 58.77% · See similar code snippets
go logo
func (e JSONEncoder) Deserialize(src []byte, dst interface{}) error {
	dec := json.NewDecoder(bytes.NewReader(src))
	if err := dec.Decode(dst); err != nil {
		return cookieError{cause: err, typ: decodeError}
	}
	return nil
}
24.
mohae/joefriday · version_unix.go
Match rating: 58.76% · See similar code snippets
go logo
func Deserialize(p []byte) (*v.Kernel, error) {
	k := &v.Kernel{}
	err := json.Unmarshal(p, k)
	if err != nil {
		return nil, err
	}
	return k, nil
}
25.
SchulIT/idp-exchange · Client.php
Match rating: 58.26% · See similar code snippets
php logo
private function deserialize(string $json, string $type) {
        $context = (new DeserializationContext())
            ->setSerializeNull(true);

        $object = $this->serializer->deserialize($json, $type, 'json', $context);
        return $object;
    }
26.
jazzband/sorl-thumbnail · helpers.py
Match rating: 58.11% · See similar code snippets
python logo
def deserialize(s):
    if isinstance(s, bytes):
        return json.loads(s.decode('utf-8'))
    return json.loads(s)
27.
ProjetPP/PPP-datamodel-PHP · AbstractReducerNodeDeserializer.php
Match rating: 58.05% · See similar code snippets
php logo
public function deserialize($serialization) {
		$this->assertCanDeserialize($serialization);
		$this->requireAttribute($serialization, 'list');
		$nodeDeserializer = $this->deserializerFactory->newNodeDeserializer();

		return $this->getDeserialization($nodeDeserializer->deserialize($serialization['list']));
	}
28.
Indoqa/logspace · EventJsonDeserializer.java
Match rating: 57.71% · See similar code snippets
java logo
public static List<Event> fromJson(JsonParser parser) throws IOException {
        return new EventJsonDeserializer(parser).deserialize(false);
    }
29.
barryosull/valueobjects · Deserializer.php
Match rating: 57.63% · See similar code snippets
php logo
public function deserialize($class, $parameters)
    {
        if ($this->extensionRepository->isExtension($class)) {
            $deserializer = $this->extensionRepository->fetch($class);
        } else {
            $deserializer = $this->deserializer_repo_fetch($class);
        }

        return $deserializer->deserialize($class, $parameters);
    }
30.
mohae/joefriday · os_unix.go
Match rating: 57.4% · See similar code snippets
go logo
func Deserialize(p []byte) (*o.OS, error) {
	os := &o.OS{}
	err := json.Unmarshal(p, os)
	if err != nil {
		return nil, err
	}
	return os, nil
}
31.
issei-m/simple-job-queue · Queue.php
Match rating: 57.34% · See similar code snippets
php logo
public function dequeue(): ?Job
    {
        $this->checkDelayed();

        $deserialized = $this->redis->lpop($this->key);
        if (null === $deserialized) {
            return null;
        }

        return $this->serializer->deserialize(\json_decode($deserialized, true));
    }
32.
foundation-runtime/service-directory · JsonSerializer.java
Match rating: 57.01% · See similar code snippets
java logo
public static <T> T deserialize(byte[] input, Class<T> classType)
            throws JsonParseException, JsonMappingException, IOException {
        return mapper.readValue(input, classType);
    }
33.
infobip/infobip-api-python-client · http.py
Match rating: 56.53% · See similar code snippets
python logo
def deserialize(self, s, cls):
        vals = json.JSONDecoder().decode(s)
        return self.deserialize_map(vals, cls)
34.
bokeh/bokeh · either.py
Match rating: 56.43% · See similar code snippets
python logo
def from_json(self, json, models=None):
        for tp in self.type_params:
            try:
                return tp.from_json(json, models)
            except DeserializationError:
                pass
        else:
            raise DeserializationError("%s couldn't deserialize %s" % (self, json))
35.
boj/redistore · redistore.go
Match rating: 56.35% · See similar code snippets
go logo
func (s JSONSerializer) Deserialize(d []byte, ss *sessions.Session) error {
	m := make(map[string]interface{})
	err := json.Unmarshal(d, &m)
	if err != nil {
		fmt.Printf("redistore.JSONSerializer.deserialize() Error: %v", err)
		return err
	}
	for k, v := range m {
		ss.Values[k] = v
	}
	return nil
}
36.
dropbox/dropbox-sdk-java · StoneSerializer.java
Match rating: 56.32% · See similar code snippets
java logo
public T deserialize(String json) throws JsonParseException {
        try {
            JsonParser p = Util.JSON.createParser(json);
            p.nextToken();
            return deserialize(p);
        } catch (JsonParseException ex) {
            throw ex;
        } catch (IOException ex) {
            throw new IllegalStateException("Impossible I/O exception", ex);
        }
    }
37.
signalapp/libsignal-service-java · JsonUtil.java
Match rating: 56.14% · See similar code snippets
java logo
public static <T> T fromJson(String json, Class<T> clazz)
      throws IOException
  {
    return objectMapper.readValue(json, clazz);
  }
38.
yangjm/winlet · JsonUtils.java
Match rating: 55.6% · See similar code snippets
java logo
public static <T> T fromJSON(final TypeReference<T> type,
			final String jsonPacket) throws JsonParseException,
			JsonMappingException, IOException {
		T data = null;

		data = new ObjectMapper().readValue(jsonPacket, type);
		return data;
	}
39.
zutnop/telekom-workflow-engine · JsonUtil.java
Match rating: 55.45% · See similar code snippets
java logo
public static Object deserialize( String json ){
        if( json == null ){
            return null;
        }
        return deserialize( json, null );
    }
40.
spotify/styx · Json.java
Match rating: 55.18% · See similar code snippets
java logo
public static <T> T deserialize(ByteString json, Class<T> clazz) throws IOException {
    return OBJECT_MAPPER.readValue(json.toByteArray(), clazz);
  }
41.
bokeh/bokeh · container.py
Match rating: 54.96% · See similar code snippets
python logo
def from_json(self, json, models=None):
        if json is None:
            return None
        elif isinstance(json, dict):
            return { self.keys_type.from_json(key, models): self.values_type.from_json(value, models) for key, value in iteritems(json) }
        else:
            raise DeserializationError("%s expected a dict or None, got %s" % (self, json))
42.
biezhi/wechat-api · WeChatUtils.java
Match rating: 54.71% · See similar code snippets
java logo
public static <T> T fromJson(String json, Class<T> from) {
        return GSON.fromJson(json, from);
    }
43.
pavlov99/json-rpc · jsonrpc2.py
Match rating: 54.34% · See similar code snippets
python logo
def from_json(cls, json_str):
        data = cls.deserialize(json_str)
        return cls.from_data(data)
44.
Match rating: 54.21% · See similar code snippets
ruby logo
def deserialize_account(account_json)
      FioAPI::Account.new(
        account_id:       account_json.try_path('accountId'),
        bank_id:          account_json.try_path('bankId'),
        currency:         account_json.try_path('currency'),
        iban:             account_json.try_path('iban'),
        bic:              account_json.try_path('bic'),
        opening_balance:  account_json.try_path('openingBalance'),
        closing_balance:  account_json.try_path('closingBalance'),
        date_start:       account_json.try_path('dateStart'),
        date_end:         account_json.try_path('dateEnd'),
        year_list:        account_json.try_path('yearList'),
        id_list:          account_json.try_path('idList'),
        id_from:          account_json.try_path('idFrom'),
        id_to:            account_json.try_path('idTo'),
        id_last_download: account_json.try_path('idLastDownload')
      )
    end
45.
F483/apigen · apigen.py
Match rating: 53.97% · See similar code snippets
python logo
def _deserialize(kwargs):
    def deserialize(item):
        if isinstance(item[1], str):
            try:
                data = json.loads(item[1])  # load as json
            except:
                data = item[1].decode('utf-8')  # must be a string
        else:
            data = item[1]  # already deserialized (method default value)
        return (item[0], data)
    return dict(map(deserialize, kwargs.items()))
46.
AirtestProject/Poco · utils.py
Match rating: 53.72% · See similar code snippets
python logo
def from_json(cls, json_str):
        data = cls.deserialize(json_str)

        if not isinstance(data, dict):
            raise ValueError("data should be dict")

        return cls(**data)
47.
ask/carrot · serialization.py
Match rating: 53.67% · See similar code snippets
python logo
def register_json():
    """Register a encoder/decoder for JSON serialization."""
    from anyjson import serialize as json_serialize
    from anyjson import deserialize as json_deserialize

    registry.register('json', json_serialize, json_deserialize,
                      content_type='application/json',
                      content_encoding='utf-8')
48.
wasp/waspy · parser.py
Match rating: 53.5% · See similar code snippets
python logo
def decode(self, data: bytes):
        if data:
            try:
                return json.loads(data)
            except json.JSONDecodeError:
                raise ParseError("Invalid JSON")
49.
ClericPy/torequests · _py3_patch.py
Match rating: 53.22% · See similar code snippets
python logo
def json(self, encoding=None, loads=json.loads):
        return loads(self.content.decode(encoding or self.encoding))
50.
Match rating: 52.47% · See similar code snippets
ruby logo
def deserialize_import(response_json)
      return FioAPI::Payments::Status.new(error_code: 500) unless response_json
      FioAPI::Payments::Status.new(
        error_code: response_json.try_path('errorCode').to_i,
        error_message: response_json.try_path('message').to_s,
        id_instruction: response_json.try_path('idInstruction').to_i,
        sum_credit: response_json.try_path('sums', 'sum', 'sumCredit').to_f,
        sum_debet: response_json.try_path('sums', 'sum', 'sumDebet').to_f
      )
    end
51.
mohae/joefriday · net.go
Match rating: 51.77% · See similar code snippets
go logo
func BenchNetDevDeserializeJSON(b *testing.B) {
	var inf *structs.DevInfo
	p, _ := djson.NewProfiler()
	tmp, _ := p.Get()
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		inf, _ = djson.Deserialize(tmp)
	}
	_ = inf
}
52.
boj/redistore · redistore.go
Match rating: 49.73% · See similar code snippets
go logo
func (s GobSerializer) Deserialize(d []byte, ss *sessions.Session) error {
	dec := gob.NewDecoder(bytes.NewBuffer(d))
	return dec.Decode(&ss.Values)
}
53.
instructure/ims-lti · lti_model.rb
Match rating: 48.85% · See similar code snippets
ruby logo
def from_json(json)
      json = json.to_json unless json.is_a?(String)
      begin
        data = JSON.parse(json)
      rescue
        data = JSON.parse(URI.unescape(json))
      end

      if data.is_a? Array
        data.map { |hash| self.class.from_json(hash.to_json) }
      else
        process_json_hash(data)
      end
    end
54.
mohae/joefriday · sysinfo.go
Match rating: 48.42% · See similar code snippets
go logo
func BenchSysinfoLoadAvgDeserializeJSON(b *testing.B) {
	var l *load.LoadAvg
	tmp, _ := ljson.Get()
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		l, _ = ljson.Deserialize(tmp)
	}
	_ = l
}
55.
hyperledger/burrow · source.go
Match rating: 47.0% · See similar code snippets
go logo
func FromJSONString(jsonString string, conf interface{}) error {
	err := json.Unmarshal(([]byte)(jsonString), conf)
	if err != nil {
		return err
	}
	return nil
}
56.
cloudfoundry/bosh · instance.rb
Match rating: 45.81% · See similar code snippets
ruby logo
def spec
      return nil if spec_json.nil?

      begin
        result = JSON.parse(spec_json)
      rescue JSON::ParserError
        return 'error'
      end

      result
    end
57.
travis-ci/travis-core · formats.rb
Match rating: 45.62% · See similar code snippets
ruby logo
def normalize_json(json)
      json = json.to_json unless json.is_a?(String)
      JSON.parse(json)
    end
58.
soulim/oembed · parser.rb
Match rating: 45.44% · See similar code snippets
ruby logo
def json(body)
      begin
        JSON.parse(body)
      rescue JSON::JSONError => e
        raise Oembed::ParserError.new(e), 'JSON parser error'
      end
    end
59.
westlakedesign/auth_net_receiver · raw_transaction.rb
Match rating: 45.16% · See similar code snippets
ruby logo
def json_data
      begin
        return JSON.parse(self.data)
      rescue JSON::ParserError, TypeError => e
        logger.warn "Error while parsing raw transaction data: #{e.message}"
        return {}
      end
    end
60.
kost/nessus_rest-ruby · nessus_rest.rb
Match rating: 45.07% · See similar code snippets
ruby logo
def parse_json(body)
      buf = {}

      begin
        buf = JSON.parse(body)
      rescue JSON::ParserError
      end

      buf
    end