zutnop/telekom-workflow-engine · JsonUtil.java
java logo
public static Object deserialize( String json ){
        if( json == null ){
            return null;
        }
        return deserialize( json, null );
    }
Similar code snippets
1.
duracloud/duracloud · JaxbJsonSerializer.java
Match rating: 65.34% · See similar code snippets
java logo
public T deserialize(String json) throws IOException {
        return (T) mapper.readValue(json, type);
    }
2.
auth0/Auth0.Android · UserProfileDeserializer.java
Match rating: 62.91% · See similar code snippets
java logo
@Override
    public UserProfile deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        if (!json.isJsonObject() || json.isJsonNull() || json.getAsJsonObject().entrySet().isEmpty()) {
            throw new JsonParseException("user profile json is not a valid json object");
        }

        JsonObject object = json.getAsJsonObject();
        final String id = context.deserialize(object.remove("user_id"), String.class);
        final String name = context.deserialize(object.remove("name"), String.class);
        final String nickname = context.deserialize(object.remove("nickname"), String.class);
        final String picture = context.deserialize(object.remove("picture"), String.class);

        final String email = context.deserialize(object.remove("email"), String.class);
        final String givenName = context.deserialize(object.remove("given_name"), String.class);
        final String familyName = context.deserialize(object.remove("family_name"), String.class);
        final Boolean emailVerified = object.has("email_verified") ? context.<Boolean>deserialize(object.remove("email_verified"), Boolean.class) : false;
        final Date createdAt = context.deserialize(object.remove("created_at"), Date.class);

        final Type identitiesType = new TypeToken<List<UserIdentity>>() {}.getType();
        final List<UserIdentity> identities = context.deserialize(object.remove("identities"), identitiesType);

        final Type metadataType = new TypeToken<Map<String, Object>>() {}.getType();
        Map<String, Object> userMetadata = context.deserialize(object.remove("user_metadata"), metadataType);
        Map<String, Object> appMetadata = context.deserialize(object.remove("app_metadata"), metadataType);
        Map<String, Object> extraInfo = context.deserialize(object, metadataType);
        return new UserProfile(id, name, nickname, picture, email, emailVerified, familyName, createdAt, identities, extraInfo, userMetadata, appMetadata, givenName);
    }
3.
spotify/styx · Json.java
Match rating: 62.63% · 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);
  }
4.
open-pay/openpay-java · DefaultSerializer.java
Match rating: 62.49% · See similar code snippets
java logo
@Override
    public <T> T deserialize(final String json, final Class<T> clazz) {
        return this.gson.fromJson(json, clazz);
    }
5.
czyzby/gdx-lml · JsonSerializer.java
Match rating: 62.08% · See similar code snippets
java logo
@Override
    public Object deserialize(final String data) {
        try {
            return json.fromJson(null, data);
        } catch (final Exception exception) {
            throw new SerializationException("Unable to deserialize object from JSON.", exception);
        }
    }
6.
vakinge/jeesuite-libs · SerializeUtils.java
Match rating: 61.73% · See similar code snippets
java logo
public static Object deserialize(byte[] bytes) {
    	try {
			return serializer.deserialize(bytes);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
    }
7.
googleapis/google-http-java-client · IOUtils.java
Match rating: 60.99% · See similar code snippets
java logo
public static <S extends Serializable> S deserialize(byte[] bytes) throws IOException {
    if (bytes == null) {
      return null;
    }
    return deserialize(new ByteArrayInputStream(bytes));
  }
8.
calrissian/mango · Serializables.java
Match rating: 60.24% · See similar code snippets
java logo
public static <T extends Serializable> T deserialize(byte[] bytes) throws IOException, ClassNotFoundException {
        return deserialize(bytes, false);
    }
9.
duracloud/duracloud · AuditTask.java
Match rating: 60.11% · See similar code snippets
java logo
protected static Map<String, String> deserializeContentProperties(String json) {
        if (StringUtils.isNotBlank(json)) {
            try {
                return getPropsSerializer().deserialize(json);
            } catch (IOException e) {
                throw new DuraCloudRuntimeException(e);
            }
        }
        return null;
    }
10.
auth0/Auth0.Android · CredentialsDeserializer.java
Match rating: 59.0% · See similar code snippets
java logo
@Override
    public Credentials deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        if (!json.isJsonObject() || json.isJsonNull() || json.getAsJsonObject().entrySet().isEmpty()) {
            throw new JsonParseException("credentials json is not a valid json object");
        }

        JsonObject object = json.getAsJsonObject();
        final String idToken = context.deserialize(object.remove("id_token"), String.class);
        final String accessToken = context.deserialize(object.remove("access_token"), String.class);
        final String type = context.deserialize(object.remove("token_type"), String.class);
        final String refreshToken = context.deserialize(object.remove("refresh_token"), String.class);
        final Long expiresIn = context.deserialize(object.remove("expires_in"), Long.class);
        final String scope = context.deserialize(object.remove("scope"), String.class);
        Date expiresAt = context.deserialize(object.remove("expires_at"), Date.class);
        if (expiresAt == null && expiresIn != null) {
            expiresAt = new Date(getCurrentTimeInMillis() + expiresIn * 1000);
        }

        return createCredentials(idToken, accessToken, type, refreshToken, expiresAt, scope);
    }