Package org.apache.wink.json4j

Examples of org.apache.wink.json4j.JSONStringer.array()


     */
    public void test_WriteEmptyArray() {
        Exception ex = null;
        try{
            JSONStringer jStringer = new JSONStringer();
            jStringer.array();
            jStringer.endArray();
            String str = jStringer.toString();
            // Verify it parses.
            JSONArray test = new JSONArray(str);
            assertTrue(str.equals("[]"));
View Full Code Here


            jStringer.value("String2");
            jStringer.endObject();

            // Place an array
            jStringer.key("array");
            jStringer.array();
            jStringer.value(1);
            jStringer.value((double)2);
            jStringer.value((short)3);
            jStringer.endArray();
View Full Code Here

     */
    public void test_WriteArrayComplex() {
        Exception ex = null;
        try{
            JSONStringer jStringer = new JSONStringer();
            jStringer.array();
            jStringer.value("String1");
            jStringer.value(false);
            jStringer.value(1);

            // Place an object
View Full Code Here

            jStringer.key("string");
            jStringer.value("String2");
            jStringer.endObject();

            // Place an array
            jStringer.array();
            jStringer.value(1);
            jStringer.value((double)2);
            jStringer.value((short)3);
            jStringer.endArray();
View Full Code Here

     */
    public void test_OptsAfterCloseFail() {
        Exception ex = null;
        try{
            JSONStringer jStringer = new JSONStringer();
            jStringer.array();
            jStringer.toString();

            // This should die.
            jStringer.endArray();
        }catch(Exception ex1){
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.