2324252627282930313233
writer.writeObject("2"); writer.writeObject("c"); writer.writeObject("3"); writer.endObject(); writer.close(); Assert.assertEquals("{'a':'1','b':'2','c':'3'}", out.toString()); } }
1617181920212223242526
JSONWriter writer = new JSONWriter(out); writer.config(SerializerFeature.UseSingleQuotes, true); writer.startObject(); writer.startObject(); writer.endObject(); writer.startObject(); writer.endObject(); writer.endObject();
1920212223242526272829
writer.startObject(); writer.endObject(); writer.startObject(); writer.endObject(); writer.endObject(); writer.close(); Assert.assertEquals("{{}:{}}", out.toString());
2122232425262728293031
writer.endObject(); writer.startObject(); writer.endObject(); writer.endObject(); writer.close(); Assert.assertEquals("{{}:{}}", out.toString()); } }
writer.writeObject("2"); writer.writeObject("c"); writer.writeObject("3"); writer.endObject(); writer.close(); Assert.assertEquals("{\"a\":\"1\",\"b\":\"2\",\"c\":\"3\"}", out.toString()); } }