Example #1
0
 @SuppressWarnings("rawtypes")
 @Override
 protected Object createNode(Object key, Map valueMap) {
   try {
     if (stack.peek().equals(BuilderMode.OBJECT)) writer.key(String.valueOf(key));
     writer.object();
     for (Object o : valueMap.entrySet()) {
       Map.Entry element = (Map.Entry) o;
       writer.key(String.valueOf(element.getKey())); // .value(element.getValue());
       json.convertAnother(element.getValue());
     }
     writer.endObject();
     return null;
   } catch (JSONException e) {
     throw new IllegalArgumentException("invalid element");
   }
 }
Example #2
0
 private void writeObject() throws JSONException {
   writer.object();
   stack.push(BuilderMode.OBJECT);
 }