Package us.monoid.json

Examples of us.monoid.json.JSONObject


    return x;
  }

  JSONObject read(URL testFile) {
    try {
      return new JSONObject(new JSONTokener(new InputStreamReader(testFile.openStream(), "UTF-8")));
    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (JSONException e) {
      // TODO Auto-generated catch block
View Full Code Here


  }
 
  @Test
  public void testArray() throws ParseException, JSONException {
    System.out.println(this.getClass().getResource("array-test.json"));
    JSONObject json = read(this.getClass().getResource("array-test.json"));
    JSONPathExpr evaluator = parse("backdrops[image.width=1280]");
    Object result = evaluator.eval(json);
    System.out.println(result);
  }
View Full Code Here

    TextResource text = r.text("http://localhost:9998/mime/multipart",
        form(data("bubu", "lala"), data("schön", "böööh")));
    String result = text.toString();
    System.out.println(result);
    assertTrue(result.contains("bubu"));
    JSONObject json = new JSONObject();
    json.put("bubu", "lala");
    text = r.text("http://localhost:9998/mime/multipart", form(data("someJson", content(json)), data("someText", "Text")));
    result = text.toString();
    System.out.println(result);
    assertTrue(result.contains("someJson") && result.contains("application/json") && result.contains("someText"));
  }
View Full Code Here

TOP

Related Classes of us.monoid.json.JSONObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.