Exemple #1
0
 @Override
 public void encode(JSONEncoder encoder) {
   // TODO Auto-generated method stub
   encoder.enterMap();
   for (String s : map.keySet()) {
     encoder.encode(s);
     encoder.encode((Double) map.get(s));
   }
   encoder.exit();
 }
Exemple #2
0
  public void testEncodeMap() {
    JSONEncoder enc = new JSONEncoder();
    enc.enterMap();
    enc.encode("a");

    enc.enterList();
    enc.encode(12);
    enc.encode(17);
    enc.exit();

    enc.encode("b");
    enc.encode(true);
    enc.exit();
    String s = enc.toString();
    assertStringsMatch("{\"a\":[12,17],\"b\":true}", s);
  }
Exemple #3
0
 @Override
 public void encode(JSONEncoder encoder) {
   Object[] items = {map.get("message"), map.get("number")};
   encoder.encode(items);
 }