MCPcopy Index your code
hub / github.com/jOOQ/jOOQ / writeJSONString

Method writeJSONString

jOOQ/src/main/java/org/jooq/tools/json/JSONArray.java:64–89  ·  view source on GitHub ↗

Encode a list into JSON text and write it to out. @see JSONValue#writeJSONString(Object, Writer)

(List<?> list, Writer out)

Source from the content-addressed store, hash-verified

62 * @see JSONValue#writeJSONString(Object, Writer)
63 */
64 public static void writeJSONString(List<?> list, Writer out) throws IOException {
65 if (list == null) {
66 out.write("null");
67 return;
68 }
69
70 boolean first = true;
71 Iterator<?> iter = list.iterator();
72
73 out.write('[');
74 while (iter.hasNext()) {
75 if (first)
76 first = false;
77 else
78 out.write(',');
79
80 Object value = iter.next();
81 if (value == null) {
82 out.write("null");
83 continue;
84 }
85
86 JSONValue.writeJSONString(value, out);
87 }
88 out.write(']');
89 }
90
91 /**
92 * Convert a list to JSON text. The result is a JSON array.

Callers 1

writeJSONStringMethod · 0.95

Calls 4

writeJSONStringMethod · 0.95
iteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65

Tested by

no test coverage detected