Package org.json.simple

Examples of org.json.simple.JSONArray


    List<Certificate> inputCerts = CryptoDataLoader.certificatesFromFile(new File(TEST_DATA_PATH));
    HttpLogClient client = new HttpLogClient("");

    JSONObject encoded = client.encodeCertificates(inputCerts);
    Assert.assertTrue(encoded.containsKey("chain"));
    JSONArray chain = (JSONArray) encoded.get("chain");
    assertEquals("Expected to have two certificates in the chain", 2, chain.size());
    // Make sure the order is reversed.
    for (int i = 0; i < inputCerts.size(); i++) {
      assertEquals(
          Base64.encodeBase64String(inputCerts.get(i).getEncoded()),
          chain.get(i));
    }
  }
View Full Code Here


        JSONObject jso = super.toJSON();
        jso.put(INDEX, this.index.toJSON());
        jso.put(TYPE, "Header");

        if(this.variables != null && this.variables.size() > 0){
            JSONArray ar = new JSONArray();
            for(String var: this.variables){
                ar.add(var);
            }
            jso.put(VARIABLES, ar);
        }

        return jso;
View Full Code Here

        jso.put(ROW, this.row.toJSON());
        jso.put(COLUMN, this.column.toJSON());
        jso.put(TYPE, "TBody");

        if(this.variables != null && this.variables.size() > 0){
            JSONArray ar = new JSONArray();
            for(String var: this.variables){
                ar.add(var);
            }
            jso.put(VARIABLES, ar);
        }

        return jso;
View Full Code Here

        JSONObject jso = super.toJSON();
        jso.put(INDEX, this.index.toJSON());
        jso.put(TYPE, "Footer");
       
        if(this.variables != null && this.variables.size() > 0){
            JSONArray ar = new JSONArray();
            for(String var: this.variables){
                ar.add(var);
            }
            jso.put(VARIABLES, ar);
        }

        return jso;
View Full Code Here

        JSONObject jso = super.toJSON();
        jso.put(INDEX, this.index.toJSON());
        jso.put(TYPE, "List");
       
        if(this.variables != null && this.variables.size() > 0){
            JSONArray ar = new JSONArray();
            for(String var: this.variables){
                ar.add(var);
            }
            jso.put(VARIABLES, ar);
        }

        return jso;
View Full Code Here

        JSONObject jso = new JSONObject();
        jso.put(ID, this.id);
        jso.put(TYPE, "UiObject");
       
        if(this.variables != null && this.variables.size() > 0){
            JSONArray ar = new JSONArray();
            for(String var: this.variables){
                ar.add(var);
            }
            jso.put(VARIABLES, ar);
        }

        return jso;
View Full Code Here

        File tempJson = File.createTempFile("Standard1", ".json");
        SSTableExport.export(reader, new PrintStream(tempJson.getPath()));
       
        JSONObject json = (JSONObject)JSONValue.parse(new FileReader(tempJson));
       
        JSONArray rowA = (JSONArray)json.get("rowA");
        JSONArray colA = (JSONArray)rowA.get(0);
        assert Arrays.equals(hexToBytes((String)colA.get(1)), "valA".getBytes());
       
        JSONArray rowB = (JSONArray)json.get("rowB");
        JSONArray colB = (JSONArray)rowB.get(0);
        assert !(Boolean)colB.get(3);
    }
View Full Code Here

       
        JSONObject json = (JSONObject)JSONValue.parse(new FileReader(tempJson));
       
        JSONObject rowA = (JSONObject)json.get("rowA");
        JSONObject superA = (JSONObject)rowA.get(cfamily.getComparator().getString("superA".getBytes()));
        JSONArray subColumns = (JSONArray)superA.get("subColumns");
        JSONArray colA = (JSONArray)subColumns.get(0);
       
        assert Arrays.equals(hexToBytes((String)colA.get(1)), "valA".getBytes());
        assert !(Boolean)colA.get(3);      
    }
View Full Code Here

     * @param nodes nodes list.
     * @return the corresponding JSON array.
     */
    @SuppressWarnings("unchecked")
    public static JSONArray toJSONArray(List<? extends JsonWorkflowAction> nodes) {
        JSONArray array = new JSONArray();
        for (JsonWorkflowAction node : nodes) {
            array.add(node.toJSONObject());
        }
        return array;
    }
View Full Code Here

     * @param applications list.
     * @return the corresponding JSON array.
     */
    @SuppressWarnings("unchecked")
    public static JSONArray toJSONArray(List<? extends JsonCoordinatorJob> applications) {
        JSONArray array = new JSONArray();
        if (applications != null) {
            for (JsonCoordinatorJob application : applications) {
                array.add(application.toJSONObject());
            }
        }
        return array;
    }
View Full Code Here

TOP

Related Classes of org.json.simple.JSONArray

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.