Package cc.plural.jsonij

Examples of cc.plural.jsonij.JSON


    }

    @Test
    public void testExpression11() throws IOException, ParserException {
        System.out.println("Test Expression11 - Array Start Query");
        JSON json = JSON.parse("[{\"blah\":1},{\"blah\":2},{\"blah\":3},{\"blah\":4}]");
        Value value = JPath.parse("/[2]/blah").evaluate(json);
        System.out.println("Value:" + value);
        assertEquals(value.toString(), "3");
    }
View Full Code Here


    }

    @Test
    public void testExpression12() throws IOException, ParserException {
        System.out.println("Test Expression12 - Array Start Query2");
        JSON json = JSON.parse("   [\r\n"
                + "     {\r\n"
                + "       \"category\": \"reference\",\r\n"
                + "         \"author\": \"Nigel Rees\",\r\n"
                + "          \"title\": \"Sayings of the Century\",\r\n"
                + "          \"price\": 8.95\r\n"
View Full Code Here

        ArrayList<Object> interests = new ArrayList<Object>();
        interests.add("Lego");
        interests.add("Programming");
        interests.add(null);
        interests.add(new Integer(1337));
        JSON result = JSONMarshaler.marshalObject(interests);
        System.out.println(result.getRoot().toJSON());

        Person o = new Person("John", "Marsden", new BirthData(8, 5, 1981), interests);
        result = JSONMarshaler.marshalObject(o);
        System.out.println(result.getRoot().toJSON());
    }
View Full Code Here

    @Test
    public void testMarshalObject_charArray() {
        System.out.println("marshalObject(char[])");
        char[] testArray = new char[]{'J', 'o', 'h', 'n'};
        JSON result = JSONMarshaler.marshalObject(testArray);
        System.out.println(result.getRoot().toJSON());
        assertEquals(result.getRoot().toJSON(), "[\"J\",\"o\",\"h\",\"n\"]");
    }
View Full Code Here

    @Test
    public void testMarshalObject_DoubleArray() {
        System.out.println("marshalObject(double[])");
        double[] testArray = new double[]{1D, 0D, -100D, 33D, 100000000D};
        JSON result = JSONMarshaler.marshalObject(testArray);
        System.out.println(result.getRoot().toJSON());
        assertEquals(result.getRoot().toJSON(), "[1.0,0.0,-100.0,33.0,1.0E8]");
    }
View Full Code Here

    @Test
    public void testMarshalObject_doubleArray() {
        System.out.println("marshalObject(Double[])");
        Double[] testArray = new Double[]{-1.1D, 0D, -100D, -33D, 10D};
        JSON result = JSONMarshaler.marshalObject(testArray);
        System.out.println(result.getRoot().toJSON());
        assertEquals(result.getRoot().toJSON(), "[-1.1,0.0,-100.0,-33.0,10.0]");
    }
View Full Code Here

    public void testMarshalObject_List() throws JSONMarshalerException {
        System.out.println("marshalObject(List)");
        List<String> list = new ArrayList<String>();
        list.add("Element1");
        list.add("Element2");
        JSON result = JSONMarshaler.marshalObject(list);
        System.out.println(result.getRoot().toJSON());
    }
View Full Code Here

        System.out.println("marshalObject(Map)");
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("Rah", new double[]{-1.1, 0.0, -100.0, -33.0, 10.0});
        map.put("test", null);
        map.put("Object", new BirthData(8, 5, 1981));
        JSON result = JSONMarshaler.marshalObject(map);
        System.out.println(result.getRoot().toJSON());
        //assertEquals(result.getRoot().toJSON(), "[-1.1, 0.0, -100.0, -33.0, 10.0]");
    }
View Full Code Here

    public void testBookExample() throws JSONMarshalerException {
        System.out.println("bookExample");
        List<Book> bookList = new ArrayList<Book>();
        bookList.add(new Book("John Marsden", "Tomorrow When The War Began"));
        bookList.add(new Book("David Johnsonbaugh", "Discrete Mathematics"));
        JSON output = JSONMarshaler.marshalObject(bookList);
        System.out.println(output.getRoot().toJSON());
    }
View Full Code Here

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

TOP

Related Classes of cc.plural.jsonij.JSON

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.