Package org.json.simple.parser

Examples of org.json.simple.parser.JSONParser


    return xAttrs;
  }

  /** Convert xAttr names json to names list */
  private List<String> createXAttrNames(String xattrNamesStr) throws IOException {
    JSONParser parser = new JSONParser();
    JSONArray jsonArray;
    try {
      jsonArray = (JSONArray)parser.parse(xattrNamesStr);
      List<String> names = Lists.newArrayListWithCapacity(jsonArray.size());
      for (Object name : jsonArray) {
        names.add((String) name);
      }
      return names;
View Full Code Here


   * @throws IOException thrown if the <code>InputStream</code> could not be
   * JSON parsed.
   */
  static Object jsonParse(HttpURLConnection conn) throws IOException {
    try {
      JSONParser parser = new JSONParser();
      return parser.parse(new InputStreamReader(conn.getInputStream()));
    } catch (ParseException ex) {
      throw new IOException("JSON parser error, " + ex.getMessage(), ex);
    }
  }
View Full Code Here

   * @param statusJson JSON from GETFILESTATUS
   * @return The value of 'permission' in statusJson
   * @throws Exception
   */
  private String getPerms ( String statusJson ) throws Exception {
    JSONParser parser = new JSONParser();
    JSONObject jsonObject = (JSONObject) parser.parse(statusJson);
    JSONObject details = (JSONObject) jsonObject.get("FileStatus");
    return (String) details.get("permission");
  }
View Full Code Here

   * @return A List of Strings which are the elements of the ACL entries
   * @throws Exception
   */
  private List<String> getAclEntries ( String statusJson ) throws Exception {
    List<String> entries = new ArrayList<String>();
    JSONParser parser = new JSONParser();
    JSONObject jsonObject = (JSONObject) parser.parse(statusJson);
    JSONObject details = (JSONObject) jsonObject.get("AclStatus");
    JSONArray jsonEntries = (JSONArray) details.get("entries");
    if ( jsonEntries != null ) {
      for (Object e : jsonEntries) {
        entries.add(e.toString());
View Full Code Here

   * @return Map<String, byte[]> xAttrs Map
   * @throws Exception
   */
  private Map<String, byte[]> getXAttrs(String statusJson) throws Exception {
    Map<String, byte[]> xAttrs = Maps.newHashMap();
    JSONParser parser = new JSONParser();
    JSONObject jsonObject = (JSONObject) parser.parse(statusJson);
    JSONArray jsonXAttrs = (JSONArray) jsonObject.get("XAttrs");
    if (jsonXAttrs != null) {
      for (Object a : jsonXAttrs) {
        String name = (String) ((JSONObject)a).get("name");
        String value = (String) ((JSONObject)a).get("value");
View Full Code Here

                            AuthenticatedURL.AUTH_COOKIE  + "=" + tokenSigned);
    Assert.assertEquals(HttpURLConnection.HTTP_OK,
                        conn.getResponseCode());

    JSONObject json = (JSONObject)
      new JSONParser().parse(new InputStreamReader(conn.getInputStream()));
    json = (JSONObject)
      json.get(HttpFSKerberosAuthenticator.DELEGATION_TOKEN_JSON);
    String tokenStr = (String)
        json.get(HttpFSKerberosAuthenticator.DELEGATION_TOKEN_URL_STRING_JSON);
View Full Code Here

  private boolean inStatement = false;
 
 
  public PolicyParser()
  {
    jparser = new JSONParser();
    condFactory = new S3ConditionFactory();
  }
View Full Code Here

     *            the "/api" suffix)
     * @throws IOException
     *             if the server could not be contacted
     */
    public RBRestClient(String baseUrl) throws IOException {
        this.parser = new JSONParser();
        this.uriTemplates = getUriTemplates(baseUrl);
    }
View Full Code Here

        String rev2 = mk.commit("", "+\"/child2\":{}", null, "");

        String branchRev2 = mk.branch(rev2);
        String json = mk.getNodes("/child1", branchRev2, 0, 0, -1, null);
        JSONParser parser = new JSONParser();
        JSONObject obj = (JSONObject) parser.parse(json);
        assertFalse(obj.containsKey("foo"));
    }
View Full Code Here

        branchRev = mk.commit("/", ">\"a\" : \"b\"", branchRev, null);
        branchRev = mk.commit("/", ">\"b\" : \"a\"", branchRev, null);
        mk.merge(branchRev, null);

        String json = mk.getNodes("/a", null, 0, 0, -1, null);
        JSONParser parser = new JSONParser();
        JSONObject obj = (JSONObject) parser.parse(json);
        assertTrue(obj.containsKey("foo"));
    }
View Full Code Here

TOP

Related Classes of org.json.simple.parser.JSONParser

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.