Package cc.plural.jsonij

Examples of cc.plural.jsonij.Value.toJSON()


        assertEquals(v.get("name").toString(), "hello");

        v = parser.parse("{}");
       
        assertEquals(v.toJSON(), "{}");
    }

    public void testParseArray() throws IOException, ParserException {
        Value v = parser.parse("[]");
        if (!(v instanceof JSON.Array<?>)) {
View Full Code Here


        }
    }

    public void testParseString() throws IOException, ParserException {
        Value v = parser.parse(" [ \n1.20, 234, null, \"John\",true,    \n\n\n\t     - 33, 234E-34, 0.23E23  ,[33, true],   false    ]");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("[1.2, 234, null, \"John\", true, -33, 2.34E-32, 0.23, [33, true], false]");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("{\"name\":\"John\", \"data\": [1,2,3,4,5,6]}");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("{\"na$me\":\"John\",                          \"blah\": {\"silly\": [[[2, [[[[[[[true]]]]]]]]], -55]}}");
View Full Code Here

    public void testParseString() throws IOException, ParserException {
        Value v = parser.parse(" [ \n1.20, 234, null, \"John\",true,    \n\n\n\t     - 33, 234E-34, 0.23E23  ,[33, true],   false    ]");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("[1.2, 234, null, \"John\", true, -33, 2.34E-32, 0.23, [33, true], false]");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("{\"name\":\"John\", \"data\": [1,2,3,4,5,6]}");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("{\"na$me\":\"John\",                          \"blah\": {\"silly\": [[[2, [[[[[[[true]]]]]]]]], -55]}}");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
    }
View Full Code Here

        Value v = parser.parse(" [ \n1.20, 234, null, \"John\",true,    \n\n\n\t     - 33, 234E-34, 0.23E23  ,[33, true],   false    ]");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("[1.2, 234, null, \"John\", true, -33, 2.34E-32, 0.23, [33, true], false]");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("{\"name\":\"John\", \"data\": [1,2,3,4,5,6]}");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("{\"na$me\":\"John\",                          \"blah\": {\"silly\": [[[2, [[[[[[[true]]]]]]]]], -55]}}");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
    }

    public void testParseNumeric() throws IOException, ParserException {
View Full Code Here

        v = parser.parse("[1.2, 234, null, \"John\", true, -33, 2.34E-32, 0.23, [33, true], false]");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("{\"name\":\"John\", \"data\": [1,2,3,4,5,6]}");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("{\"na$me\":\"John\",                          \"blah\": {\"silly\": [[[2, [[[[[[[true]]]]]]]]], -55]}}");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
    }

    public void testParseNumeric() throws IOException, ParserException {
        parser.parse("[1,2.3,0.4,-5,-5.92,0.001E1,-0.045E45,987654321]");
    }
View Full Code Here

        bookList.add(book);
        bookBookList.add(bookList);

        JavaMarshaler marshaler = new JavaMarshaler();
        Value output = marshaler.marshalObject(bookBookList);
        System.out.println(output.toJSON());
    }

    @Test
    public void testNestedGenericMap() throws JSONMarshalerException {
        MyMap1<java.lang.String, MyMap2<java.lang.String, Integer>> mapObject = new MyMap1<java.lang.String, MyMap2<java.lang.String, Integer>>();
View Full Code Here

        innerMap.put("blah", 69);
        mapObject.put("innerMap2", innerMap);

        JavaMarshaler marshaler = new JavaMarshaler();
        Value output = marshaler.marshalObject(mapObject);
        System.out.println(output.toJSON());
    }

    public class MyOuterArray<S extends MyArray<?>> extends ArrayList<S> {

        /**
 
View Full Code Here

    public void testMarshalJSONNumericByte() throws JSONMarshalerException, IOException, ParserException {
        System.out.println("testMarshalJSONNumericByte");

        String inputJSONDocument = "1";       
        Value inputValue = JSON.parseValue(inputJSONDocument);
        System.out.println(String.format("InputJSON: %s", inputValue.toJSON()));
        Object marshal = JSONMarshaler.marshalJSON(inputValue, byte.class);
        System.out.println(String.format("MarshaledObjectToString: %s", marshal));
        Value outputValue = JSONMarshaler.marshalObjectToValue(marshal);
        System.out.println(String.format("OutputJSON: %s", outputValue));
View Full Code Here

    public void testMarshalJSONNumericFloat() throws JSONMarshalerException, IOException, ParserException {
        System.out.println("testMarshalJSONNumericFloat");

        String inputJSONDocument = "-33333";       
        Value inputValue = JSON.parseValue(inputJSONDocument);
        System.out.println(String.format("InputJSON: %s", inputValue.toJSON()));
        Object marshal = JSONMarshaler.marshalJSON(inputValue, Float.class);
        System.out.println(String.format("MarshaledObjectToString: %s", marshal));
        Value outputValue = JSONMarshaler.marshalObjectToValue(marshal);
        System.out.println(String.format("OutputJSON: %s", outputValue));
View Full Code Here

    public void testMarshalJSONNumericInteger() throws JSONMarshalerException, IOException, ParserException {
        System.out.println("testMarshalJSONNumericInteger");

        String inputJSONDocument = "1337";       
        Value inputValue = JSON.parseValue(inputJSONDocument);
        System.out.println(String.format("InputJSON: %s", inputValue.toJSON()));
        Object marshal = JSONMarshaler.marshalJSON(inputValue, int.class);
        System.out.println(String.format("MarshaledObjectToString: %s", marshal));
        Value outputValue = JSONMarshaler.marshalObjectToValue(marshal);
        System.out.println(String.format("OutputJSON: %s", outputValue));
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.