Package cc.plural.jsonij

Examples of cc.plural.jsonij.JSON$Numeric


        Map<String, Class<?>> handlers = new HashMap<String, Class<?>>();
        handlers.put("http", JSON.class);
        handlers.put("ftp", JSONMarshaler.class);
        config.setHandlers(handlers);
       
        JSON outputJSON = JSONMarshaler.marshalObject(config);
        System.out.println("Output JSON (no codec):" + outputJSON);

        JSONMarshaler.registerCodec(Class.class, ClassJSONValueCodec.class);

        outputJSON = JSONMarshaler.marshalObject(config);
View Full Code Here


    @Test
    public void testSupportEmptyObject() throws ParserException, IOException {
        System.out.println("Support Empty Object");
        String testInput = "{}";
        String testSoultion = "{}";
        JSON json = JSON.parse(testInput);
        String testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testOutput, testSoultion);
        testInput = "{   \t\t   }";
        json = JSON.parse(testInput);
        testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testOutput, testSoultion);
    }
View Full Code Here

    @Test
    public void testSupportSimpleObjectFloatValue() throws ParserException, IOException {
        System.out.println("Support simple Object float value");
        String testInput = "{ \"PI\":3.141E-10}";
        String testSoultion = "{\"PI\":3.141E-10}";
        JSON json = JSON.parse(testInput);
        String testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
        testInput = "{  \t     \"PI\"   \t   :\t   \t3.141E-10       }";
        json = JSON.parse(testInput);
        testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
    }
View Full Code Here

    @Test
    public void testSupportLowercaseFloatValue() throws ParserException, IOException {
        System.out.println("Support lowcase float value");
        String testInput = "{ \"PI\":3.141e-10}";
        String testSoultion = "{\"PI\":3.141E-10}";
        JSON json = JSON.parse(testInput);
        String testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
        testInput = "{  \t     \"PI\" :\t   \t3.141e-10    }";
        json = JSON.parse(testInput);
        testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
    }
View Full Code Here

    @Test
    public void testSupportBigintNumberSupport() throws ParserException, IOException {
        System.out.println("Bigint number support");
        String testInput = "{ \"v\":123456789123456789123456789}";
        String testSoultion = "{\"v\":123456789123456789123456789}";
        JSON json = JSON.parse(testInput);
        String testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
        testInput = "{ \t\t  \"v\"  :   123456789123456789123456789    \t }";
        json = JSON.parse(testInput);
        testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
    }
View Full Code Here

    @Test
    public void testSupportArrayOfEmptyObject() throws ParserException, IOException {
        System.out.println("Array of empty Object");
        String testInput = "[ { }, { },[]]";
        String testSoultion = "[{},{},[]]";
        JSON json = JSON.parse(testInput);
        String testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
        testInput = "[   \t { }  \t, { }\t,[  ]]";
        json = JSON.parse(testInput);
        testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
    }
View Full Code Here

    @Test
    public void testSupportDoublePrecisionPostiveFloatingPoint() throws ParserException, IOException {
        System.out.println("Double precision postive floating point");
        String testInput = "{ \"v\":1.7976931348623157E308}";
        String testSoultion = "{\"v\":1.7976931348623157E+308}";
        JSON json = JSON.parse(testInput);
        String testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
        testInput = "{   \t \"v\"  \t :  1.7976931348623157E308  }";
        json = JSON.parse(testInput);
        testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
    }
View Full Code Here

    @Test
    public void testSupportDoublePrecisionNegativeFloatingPoint() throws ParserException, IOException {
        System.out.println("Double precision negative floating point");
        String testInput = "{ \"v\":-9.87654321921234567E-200}";
        String testSoultion = "{\"v\":-9.87654321921234567E-200}";
        JSON json = JSON.parse(testInput);
        String testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
        testInput = "{   \t \"v\"  \t :  -9.87654321921234567E-200  }";
        json = JSON.parse(testInput);
        testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
    }
View Full Code Here

    @Test
    public void testUnicode() throws ParserException, IOException {
        System.out.println("Unicode");
        String testInput = "{\"lastname\":\"\\u44ff\",\"date\":\"\\u44aa\\u44ff\",\"len\":\"\\u44AA\"}";
        String testSoultion = "{\"lastname\":\"\\u44ff\",\"date\":\"\\u44aa\\u44ff\",\"len\":\"\\u44aa\"}";
        JSON json = JSON.parse(testInput);
        String testOutput = json.toJSON();
        System.out.println(String.format("\tInput: %s\r\n\tOutput: %s", testInput, testOutput));
        assertEquals(testSoultion, testOutput);
    }
View Full Code Here

TOP

Related Classes of cc.plural.jsonij.JSON$Numeric

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.