@Test public void testToJson() { Assert.assertEquals("[1, 2, 3]", JsonUtil.toJson(new long[]{1, 2, 3})); }
public static String toJson(long[] ids) { StringBuilder sb = new StringBuilder(); sb.append("["); if (ids != null) { for (int i = 0; i < ids.length; i++) { if (i > 0) { sb.append(", "); } sb.append(ids[i]); } } sb.append("]"); return sb.toString(); }
JsonUtil { public static String toJson(long[] ids) { StringBuilder sb = new StringBuilder(); sb.append("["); if (ids != null) { for (int i = 0; i < ids.length; i++) { if (i > 0) { sb.append(", "); } sb.append(ids[i]); } } sb.append("]"); return sb.toString(); } }
JsonUtil { public static String toJson(long[] ids) { StringBuilder sb = new StringBuilder(); sb.append("["); if (ids != null) { for (int i = 0; i < ids.length; i++) { if (i > 0) { sb.append(", "); } sb.append(ids[i]); } } sb.append("]"); return sb.toString(); }  }
JsonUtil { public static String toJson(long[] ids) { StringBuilder sb = new StringBuilder(); sb.append("["); if (ids != null) { for (int i = 0; i < ids.length; i++) { if (i > 0) { sb.append(", "); } sb.append(ids[i]); } } sb.append("]"); return sb.toString(); }  static String toJsonStr(String value); static boolean isValidJsonObject(String json); static boolean isValidJsonObject(String json, boolean allowBlank); static boolean isValidJsonArray(String json); static boolean isValidJsonArray(String json, boolean allowBlank); static String toJson(long[] ids); static String toJson(Jsonable[] values); }
JsonUtil { public static String toJson(long[] ids) { StringBuilder sb = new StringBuilder(); sb.append("["); if (ids != null) { for (int i = 0; i < ids.length; i++) { if (i > 0) { sb.append(", "); } sb.append(ids[i]); } } sb.append("]"); return sb.toString(); }  static String toJsonStr(String value); static boolean isValidJsonObject(String json); static boolean isValidJsonObject(String json, boolean allowBlank); static boolean isValidJsonArray(String json); static boolean isValidJsonArray(String json, boolean allowBlank); static String toJson(long[] ids); static String toJson(Jsonable[] values);  }