Package cc.plural.jsonij

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


    @Test
    public void testToString() {
        System.out.println("toString");
        Value value = JSON.TRUE;
        assertEquals(value.toJSON(), "true");
    }
}
View Full Code Here


       
        Value value3 = new JSON.String("this is a string with a tab \t character");
        assertEquals(value3, new JSON.String("this is a string with a tab \t character"));
       
        Value value4 = new JSON.String("this is a string with a %7BURL-encoded%7D character");
        assertEquals(value4.toJSON(), "\"this is a string with a %7BURL-encoded%7D character\"");

        assertNotSame(value1, value2);
        assertNotSame(value2, value3);
        assertNotSame(value3, value4);
       
View Full Code Here

   
    @Test
    public void testToJSON() {
        System.out.println("toJSON");
        Value value1 = new JSON.String(null);
        assertEquals(value1.toJSON(), "\"\"");
        Value value2 = new JSON.String("Value 2");
        assertEquals(value2.toJSON(), "\"Value 2\"");
        Value value3 = new JSON.String("this is a string with a tab \t character");
        assertEquals(value3.toJSON(), "\"this is a string with a tab \\t character\"");
        Value value4 = new JSON.String("this is a string with a %7BURL-encoded%7D character");
View Full Code Here

    public void testToJSON() {
        System.out.println("toJSON");
        Value value1 = new JSON.String(null);
        assertEquals(value1.toJSON(), "\"\"");
        Value value2 = new JSON.String("Value 2");
        assertEquals(value2.toJSON(), "\"Value 2\"");
        Value value3 = new JSON.String("this is a string with a tab \t character");
        assertEquals(value3.toJSON(), "\"this is a string with a tab \\t character\"");
        Value value4 = new JSON.String("this is a string with a %7BURL-encoded%7D character");
        assertEquals(value4.toJSON(), "\"this is a string with a %7BURL-encoded%7D character\"");
    }
View Full Code Here

        Value value1 = new JSON.String(null);
        assertEquals(value1.toJSON(), "\"\"");
        Value value2 = new JSON.String("Value 2");
        assertEquals(value2.toJSON(), "\"Value 2\"");
        Value value3 = new JSON.String("this is a string with a tab \t character");
        assertEquals(value3.toJSON(), "\"this is a string with a tab \\t character\"");
        Value value4 = new JSON.String("this is a string with a %7BURL-encoded%7D character");
        assertEquals(value4.toJSON(), "\"this is a string with a %7BURL-encoded%7D character\"");
    }
   
    @Test
View Full Code Here

        Value value2 = new JSON.String("Value 2");
        assertEquals(value2.toJSON(), "\"Value 2\"");
        Value value3 = new JSON.String("this is a string with a tab \t character");
        assertEquals(value3.toJSON(), "\"this is a string with a tab \\t character\"");
        Value value4 = new JSON.String("this is a string with a %7BURL-encoded%7D character");
        assertEquals(value4.toJSON(), "\"this is a string with a %7BURL-encoded%7D character\"");
    }
   
    @Test
    public void testToString() {
        System.out.println("toString");
View Full Code Here

    @Test
    public void testMarshalJSONArray() throws JSONMarshalerException, IOException, ParserException {
        System.out.println("testMarshalJSONArray");
        String inputJSONDocument = "[]";
        Value inputValue = JSON.parseValue(inputJSONDocument);
        System.out.println(String.format("InputJSON: %s", inputValue.toJSON()));
        Object marshal = JSONMarshaler.marshalJSON(inputValue, Object[].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

    @Test
    public void testMarshalJSONArrayBoolean() throws JSONMarshalerException, IOException, ParserException {
        System.out.println("testMarshalJSONArrayBoolean");
        String inputJSONDocument = "[true, false, true, true, true, false]";
        Value inputValue = JSON.parseValue(inputJSONDocument);
        System.out.println(String.format("InputJSON: %s", inputValue.toJSON()));
        Object marshal = JSONMarshaler.marshalJSON(inputValue, boolean[].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

    @Test
    public void testMarshalJSONArrayInt() throws JSONMarshalerException, IOException, ParserException {
        System.out.println("testMarshalJSONArrayInt");
        String inputJSONDocument = "[1, 2, 3, -1000, 0, -55]";
        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));
        assertNotNull(marshal);
View Full Code Here

    @Test
    public void testMarshalJSONArrayString() throws JSONMarshalerException, IOException, ParserException {
        System.out.println("testMarshalJSONArrayString");
        String inputJSONDocument = "[\"\",\"Rah\",\"Blah Blah Blah Blah\"]";
        Value inputValue = JSON.parseValue(inputJSONDocument);
        System.out.println(String.format("InputJSON: %s", inputValue.toJSON()));
        Object marshal = JSONMarshaler.marshalJSON(inputValue, String[].class);
        System.out.println(String.format("MarshaledObjectToString: %s", marshal));
        Value outputValue = JSONMarshaler.marshalObjectToValue(marshal);
        System.out.println(String.format("OutputJSON: %s", outputValue));
        assertNotNull(marshal);
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.