Package org.codehaus.jettison.json

Examples of org.codehaus.jettison.json.JSONObject.optJSONArray()


        assertEquals("knows", m.getJSONArray("_inE").getJSONObject(0).optString("_label"));

        assertEquals(s.getString("name"), "stephen");
        assertEquals(s.getLong("_id"), 2l);
        assertFalse(m.has("_type"));
        assertNull(s.optJSONArray("_outE"));
        assertNull(s.optJSONArray("_inE"));

    }
}
View Full Code Here


        assertEquals(s.getString("name"), "stephen");
        assertEquals(s.getLong("_id"), 2l);
        assertFalse(m.has("_type"));
        assertNull(s.optJSONArray("_outE"));
        assertNull(s.optJSONArray("_inE"));

    }
}
View Full Code Here

            child.setMessage(subJson.optString("message"));
            Properties props = (Properties) extractMap(subJson.optJSONObject("properties"), new Properties());
            for (Map.Entry entry : props.entrySet()) {
                child.addProperty(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
            }
            fillSubMessages(child, subJson.optJSONArray("children"));
        }
    }
   
//    private void fillMessage(ActionReport.MessagePart mp, JSONObject json) throws JSONException {
//        mp.setMessage(json.optString("value"));
View Full Code Here

  static Collection<ErrorCollection> extractErrors(final int status, final String body) throws JSONException {
    if (body == null) {
      return Collections.emptyList();
    }
    final JSONObject jsonObject = new JSONObject(body);
    final JSONArray issues = jsonObject.optJSONArray("issues");
    final ImmutableList.Builder<ErrorCollection> results = ImmutableList.builder();
    if (issues != null && issues.length() == 0) {
      final JSONArray errors = jsonObject.optJSONArray("errors");
      for (int i = 0; i < errors.length(); i++) {
        final JSONObject currentJsonObject = errors.getJSONObject(i);
View Full Code Here

    }
    final JSONObject jsonObject = new JSONObject(body);
    final JSONArray issues = jsonObject.optJSONArray("issues");
    final ImmutableList.Builder<ErrorCollection> results = ImmutableList.builder();
    if (issues != null && issues.length() == 0) {
      final JSONArray errors = jsonObject.optJSONArray("errors");
      for (int i = 0; i < errors.length(); i++) {
        final JSONObject currentJsonObject = errors.getJSONObject(i);
        results.add(getErrorsFromJson(currentJsonObject.getInt("status"), currentJsonObject
            .optJSONObject("elementErrors")));
      }
View Full Code Here

        JSONObject entity = (JSONObject) response.getJerseyResponse().getEntity();

        Assert.assertNotNull(entity);
        Assert.assertTrue(entity.has(Tokens.RESULTS));

        JSONArray results = entity.optJSONArray(Tokens.RESULTS);

        Assert.assertNotNull(results);
        Assert.assertEquals(2, results.length());

    }
View Full Code Here

        JSONObject entity = (JSONObject) response.getJerseyResponse().getEntity();

        Assert.assertNotNull(entity);
        Assert.assertTrue(entity.has(Tokens.RESULTS));

        JSONArray results = entity.optJSONArray(Tokens.RESULTS);

        Assert.assertNotNull(results);
        Assert.assertEquals(2, results.length());

    }
View Full Code Here

        JSONObject entity = (JSONObject) response.getJerseyResponse().getEntity();

        Assert.assertNotNull(entity);
        Assert.assertTrue(entity.has(Tokens.RESULTS));

        JSONArray results = entity.optJSONArray(Tokens.RESULTS);

        Assert.assertNotNull(results);
        Assert.assertEquals(2, results.length());
        Assert.assertTrue(contains(results, "age", 27));
        Assert.assertTrue(contains(results, "age", 29));
View Full Code Here

        JSONObject entity = (JSONObject) response.getJerseyResponse().getEntity();

        Assert.assertNotNull(entity);
        Assert.assertTrue(entity.has(Tokens.RESULTS));

        JSONArray results = entity.optJSONArray(Tokens.RESULTS);

        Assert.assertNotNull(results);
        Assert.assertEquals(2, results.length());
        Assert.assertTrue(contains(results, "age", 27));
        Assert.assertTrue(contains(results, "age", 29));
View Full Code Here

        JSONObject entity = (JSONObject) response.getJerseyResponse().getEntity();

        Assert.assertNotNull(entity);
        Assert.assertTrue(entity.has(Tokens.RESULTS));

        JSONArray results = entity.optJSONArray(Tokens.RESULTS);

        Assert.assertNotNull(results);
        Assert.assertEquals(2, results.length());

    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.