public class JSONOutputTest {
@Test
public void test() {
JSONNode node = new JSONNode();
assertEquals("{}", node.toJSONString());
node.add(new JSONAttribute("id", "0", AttrType.Number));
node.add(new JSONAttribute("name", "root object", AttrType.String));
JSONArray array = new JSONArray("childs");
for (int i = 0; i < 10; i++) {
JSONNode node1 = new JSONNode();
node1.add(new JSONAttribute("id", "" + i, AttrType.Number));
node1.add(new JSONAttribute("name","child node " + i, AttrType.String));
node1.add(new JSONAttribute("created","01.01.1970", AttrType.Date));
array.add(node1);
}
node.add(array);