Package cc.plural.jsonij

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


        System.out.println("Unicode");
        String testInput = "{\"lastname\":\"\\u44ff\",\"date\":\"\\u44aa\\u44ff\",\"len\":\"\\u44AA\"}";
        String testSoultion = "{\"lastname\":\"\\u44ff\",\"date\":\"\\u44aa\\u44ff\",\"len\":\"\\u44aa\"}";
        for(int i=0;i<500000;i++) {
            JSON json = JSON.parse(testInput);
            String testOutput = json.toJSON();
            assertEquals(testSoultion, testOutput);
        }
    }
}
View Full Code Here


        return media;
    }

    static void writeMedia(StringWriter writer, Media media) throws Exception {
        JSON json = JSONMarshaler.marshalObject(media);
        writer.write(json.toJSON());
    }

    static void writeImage(StringWriter writer, Image image) throws Exception {
        JSON json = JSONMarshaler.marshalObject(image);
        writer.write(json.toJSON());
View Full Code Here

        writer.write(json.toJSON());
    }

    static void writeImage(StringWriter writer, Image image) throws Exception {
        JSON json = JSONMarshaler.marshalObject(image);
        writer.write(json.toJSON());
    }

    static void writeImages(StringWriter writer, List<Image> images) throws Exception {
        JSON json = JSONMarshaler.marshalObject(images);
        writer.write(json.toJSON());
View Full Code Here

        writer.write(json.toJSON());
    }

    static void writeImages(StringWriter writer, List<Image> images) throws Exception {
        JSON json = JSONMarshaler.marshalObject(images);
        writer.write(json.toJSON());
    }

    static void writeMediaContent(StringWriter writer, MediaContent mediaContent) throws Exception {
        JSON json = JSONMarshaler.marshalObject(mediaContent);
        writer.write(json.toJSON());
View Full Code Here

        writer.write(json.toJSON());
    }

    static void writeMediaContent(StringWriter writer, MediaContent mediaContent) throws Exception {
        JSON json = JSONMarshaler.marshalObject(mediaContent);
        writer.write(json.toJSON());
    }
}
View Full Code Here

                + "         \"Country\":   \"US\""
                + "      }"
                + "   ]";
        for (int i = 0; i < 10000; i++) {
            JSON json = JSON.parse(input);
            String outputJSON = json.toJSON();
        }
    }
}
View Full Code Here

        JSONMarshaler.ALWAYS_USE_INNER_PROPERTY = false;
        JSON json1 = JSONMarshaler.marshalObject(map1);
        JSON jsonExpected1 = JSON.parse("{\"key2\":\"value2\",\"key1\":\"value1\"}");
       
        System.out.println("Parsed:" + json1.toJSON());
        System.out.println("Expected:" + jsonExpected1.toJSON());
        assertTrue(json1.equals(jsonExpected1));

        JSONMarshaler.ALWAYS_USE_INNER_PROPERTY = true;
        JSON json2 = JSONMarshaler.marshalObject(map1);
       
View Full Code Here

        JSONMarshaler.ALWAYS_USE_INNER_PROPERTY = true;
        JSON json2 = JSONMarshaler.marshalObject(map1);
       
        JSON jsonExpected2 = JSON.parse("{\"$innerObject\":{\"key2\":\"value2\",\"key1\":\"value1\"}}");
        System.out.println("Parsed:" + json2.toJSON());
        System.out.println("Expected:" + jsonExpected2.toJSON());
        assertTrue(json2.equals(jsonExpected2));
    }

    @Test
    public void testMapPropsPrint() throws ParserException, IOException {
View Full Code Here

        map1.setPrivateInt(55);
        map1.publicString = "rah";

        JSONMarshaler.ALWAYS_USE_INNER_PROPERTY = false;
        JSON json1 = JSONMarshaler.marshalObject(map1);
        System.out.println(json1.toJSON());

        assertTrue(json1.equals(JSON.parse("{\"$innerObject\":{\"key2\":\"value2\",\"key1\":\"value1\"},\"privateInt\":55,\"publicString\":\"rah\"}")));
       
        JSONMarshaler.ALWAYS_USE_INNER_PROPERTY = true;
        JSON json2 = JSONMarshaler.marshalObject(map1);
View Full Code Here

        assertTrue(json1.equals(JSON.parse("{\"$innerObject\":{\"key2\":\"value2\",\"key1\":\"value1\"},\"privateInt\":55,\"publicString\":\"rah\"}")));
       
        JSONMarshaler.ALWAYS_USE_INNER_PROPERTY = true;
        JSON json2 = JSONMarshaler.marshalObject(map1);
        System.out.println(json2.toJSON());
       
        assertTrue(json2.equals(JSON.parse("{\"$innerObject\":{\"key2\":\"value2\",\"key1\":\"value1\"},\"privateInt\":55,\"publicString\":\"rah\"}")));
    }
   
    @Test
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.