dropbox/dropbox-sdk-java · StoneSerializer.java
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);
        }
    }
Similar code snippets
1.
dropbox/dropbox-sdk-java · StoneSerializer.java
Match rating: 71.73% · 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);
    }
2.
dropbox/dropbox-sdk-java · StructSerializer.java
Match rating: 67.73% · See similar code snippets
java logo
@Override
    public T deserialize(JsonParser p) throws IOException, JsonParseException {
        return deserialize(p, false);
    }
3.
haducloc/appslandia-common · DateAdapter.java
Match rating: 61.81% · See similar code snippets
java logo
@Override
	public java.util.Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
		try {
			return DateUtils.newDateFormat(DateUtils.PATTERN_DATE).parse(json.getAsString());
		} catch (ParseException ex) {
			throw new JsonParseException(ex);
		}
	}
4.
OnyxDevTools/onyx-database-parent · JSON.java
Match rating: 61.05% · See similar code snippets
java logo
@Override
    public Date deserialize(JsonElement json, Type date, JsonDeserializationContext context) throws JsonParseException {
        String str = json.getAsJsonPrimitive().getAsString();
        try {
            return apiClient.parseDateOrDatetime(str);
        } catch (RuntimeException e) {
            throw new JsonParseException(e);
        }
    }
5.
jembi/openhim-mediator-engine-java · CoreResponse.java
Match rating: 60.96% · See similar code snippets
java logo
public static CoreResponse parse(String content) throws ParseException {
        try {
            //get gson builder and setup with a custom date parser
            Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
                @Override
                public Date deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException {
                    //try parse as millis
                    try {
                        long value = json.getAsLong();
                        return new Date(value);
                    } catch (NumberFormatException ex) {
                        //not a long
                    }

                    //try parse as ISO date
                    try {
                        String value = json.getAsString();
                        return ISODateTimeFormat.dateTime().parseDateTime(value).toDate();
                    } catch (IllegalArgumentException ex) {
                        throw new JsonParseException(ex);
                    }
                }
            }).create();

            return gson.fromJson(content, CoreResponse.class);

        } catch (JsonParseException ex) {
            throw new ParseException(ex);
        }
    }
6.
caelum/vraptor4 · DateGsonConverter.java
Match rating: 60.18% · See similar code snippets
java logo
@Override
	public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
		try {
			return getFormat().parse(json.getAsString());
		} catch (ParseException e) {
			throw new JsonSyntaxException(json.getAsString(), e);
		}
	}
7.
haducloc/appslandia-common · SqlDateTimeAdapter.java
Match rating: 60.02% · See similar code snippets
java logo
@Override
	public java.sql.Timestamp deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
		try {
			return new java.sql.Timestamp(DateUtils.newDateFormat(DateUtils.PATTERN_DATETIME).parse(json.getAsString()).getTime());
		} catch (ParseException ex) {
			throw new JsonParseException(ex);
		}
	}
8.
KyoriPowered/text · NameMapSerializer.java
Match rating: 59.99% · See similar code snippets
java logo
@Override
  public T deserialize(final JsonElement json, final Type type, final JsonDeserializationContext context) throws JsonParseException {
    final String string = json.getAsString();
    return this.map.get(string).orElseThrow(() -> new JsonParseException("invalid " + this.name + ":  " + string));
  }
9.
caelum/vraptor4 · CalendarGsonConverter.java
Match rating: 59.86% · See similar code snippets
java logo
@Override
	public Calendar deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
		return DatatypeConverter.parseDate(json.getAsString());
	}
10.
Match rating: 58.74% · See similar code snippets
java logo
public JsonElement next() throws JsonParseException {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    
    try {
      return Streams.parse(parser);
    } catch (StackOverflowError e) {
      throw new JsonParseException("Failed parsing JSON source to Json", e);
    } catch (OutOfMemoryError e) {
      throw new JsonParseException("Failed parsing JSON source to Json", e);
    } catch (JsonParseException e) {
      throw e.getCause() instanceof EOFException ? new NoSuchElementException() : e;
    }
  }