Type type = new TypeToken<Map<String, String>>() { }.getType(); return G.fromJson(json, type);
ObjectMapper objectMapper = new ObjectMapper(); try { objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); return objectMapper.readValue(json, clazz); } catch (Exception e) { e.printStackTrace(); return null;
if (s == null) return null; StringBuffer b = new StringBuffer(); b.append("\""); CharacterIterator it = new StringCharacterIterator(s); for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) { if (c == '"') b.append("\\\""); ...
parse.
DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date d = format.parse(jsonobj.getInt("year") + "-" + jsonobj.getInt("month") + "-" + jsonobj.getInt("day")); return d;
try { return mapper.get().readValue(json, tClass); } catch (Exception e) { throw new RuntimeException(e);
Preconditions.checkNotNull(array); final GregorianCalendar calendar = new GregorianCalendar(array.get(0).getAsInt(), array.get(1).getAsInt() - 1, array.get(2).getAsInt()); final SimpleDateFormat format = new SimpleDateFormat("dd MMMM yyyy"); return format.parse(format.format(calendar.getTime()));
JSONObject jo = new JSONObject(jsonText); Map<String, Object> result = new HashMap<String, Object>(); for (int i = 0; i < params.length; i++) { result.put(params[i], jo.get(params[i])); return result;
return parseDate(_dateStr, "yyyy-MM-dd'T'HH:mm:ss");