Package cc.plural.jsonij

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


        System.out.println(value2.getValueType() + "(" + value2.nestedSize() + "): " + value2.toJSON() + " (in " + path2.getLastEvaluateTime() + " ms)");

        JPath<?> path3 = jPathParser.parse("/book[?(@.author=\"J. R. R. Tolkien\")]/title");
        path3.setRecordEvaluateTime(true);
        Value value3 = path3.evaluate(value1);
        System.out.println(value3.getValueType() + "(" + value3.nestedSize() + "): " + value3.toJSON() + " (in " + path3.getLastEvaluateTime() + " ms)");

        JPath<?> path4 = jPathParser.parse("/store/book[?(@.price=8.99)]/title");
        path4.setRecordEvaluateTime(true);
        Value value4 = path4.evaluate(json);
        System.out.println(value4.getValueType() + "(" + value4.nestedSize() + "): " + value4.toJSON() + " (in " + path4.getLastEvaluateTime() + " ms)");
View Full Code Here


        System.out.println(value3.getValueType() + "(" + value3.nestedSize() + "): " + value3.toJSON() + " (in " + path3.getLastEvaluateTime() + " ms)");

        JPath<?> path4 = jPathParser.parse("/store/book[?(@.price=8.99)]/title");
        path4.setRecordEvaluateTime(true);
        Value value4 = path4.evaluate(json);
        System.out.println(value4.getValueType() + "(" + value4.nestedSize() + "): " + value4.toJSON() + " (in " + path4.getLastEvaluateTime() + " ms)");
    }

    @Test
    public void testExpression1() throws IOException, ParserException {
        System.out.println("Test Expression1 - Single Expression Query String");
View Full Code Here

        JPathParser jPathParser = new JPathParser();
        JPath<?> path1 = jPathParser.parse("/resume/misc\\/other[0]");
        path1.setRecordEvaluateTime(true);
        Value value1 = path1.evaluate(json);
        System.out.println(value1.getValueType() + "(" + value1.nestedSize() + "): " + value1.toJSON() + " (in " + path1.getLastEvaluateTime() + " ms)");

        assertEquals("Matrikon Asia-Pacific Heart Award 2005.", value1.getString());

        JPath<?> path2 = jPathParser.parse("/resume/employment[?(@.city=\"Sydney\")]/employer");
        path2.setRecordEvaluateTime(true);
View Full Code Here

        assertEquals("Matrikon Asia-Pacific Heart Award 2005.", value1.getString());

        JPath<?> path2 = jPathParser.parse("/resume/employment[?(@.city=\"Sydney\")]/employer");
        path2.setRecordEvaluateTime(true);
        Value value2 = path2.evaluate(json);
        System.out.println(value1.getValueType() + "(" + value2.nestedSize() + "): " + value2.toJSON() + " (in " + path2.getLastEvaluateTime() + " ms)");

        assertEquals("IBM", value2.getString());
    }

    @Test
View Full Code Here

        JPathParser jPathParser = new JPathParser();

        JPath<?> path1 = jPathParser.parse("/resume/employment[?(@.city=\"Newcastle\" && @.start date={\"day\":1,\"month\":8,\"year\":2003})]/employer");
        path1.setRecordEvaluateTime(true);
        Value value1 = path1.evaluate(json);
        System.out.println(value1.getValueType() + "(" + value1.nestedSize() + "): " + value1.toJSON() + " (in " + path1.getLastEvaluateTime() + " ms)");

        assertEquals("Matrikon", value1.getString());
    }

    @Test
View Full Code Here

        owner.setBook(book);

        System.out.println("0 nested levels");
        JavaMarshaler marshaler = new JavaMarshaler();
        Value output = marshaler.marshalObject(book);
        System.out.println(output.toJSON());

        output = marshaler.marshalObject(owner);
        System.out.println(output.toJSON());

        System.out.println("1 nested level");
View Full Code Here

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

        output = marshaler.marshalObject(owner);
        System.out.println(output.toJSON());

        System.out.println("1 nested level");
        JSONMarshaler.setCycleLevels(1);
        marshaler = new JavaMarshaler();
        output = marshaler.marshalObject(book);
View Full Code Here

        System.out.println("1 nested level");
        JSONMarshaler.setCycleLevels(1);
        marshaler = new JavaMarshaler();
        output = marshaler.marshalObject(book);
        System.out.println(output.toJSON());

        output = marshaler.marshalObject(owner);
        System.out.println(output.toJSON());

        System.out.println("2 nested levels");
View Full Code Here

        marshaler = new JavaMarshaler();
        output = marshaler.marshalObject(book);
        System.out.println(output.toJSON());

        output = marshaler.marshalObject(owner);
        System.out.println(output.toJSON());

        System.out.println("2 nested levels");
        JSONMarshaler.setCycleLevels(2);
        marshaler = new JavaMarshaler();
        output = marshaler.marshalObject(book);
View Full Code Here

        System.out.println("2 nested levels");
        JSONMarshaler.setCycleLevels(2);
        marshaler = new JavaMarshaler();
        output = marshaler.marshalObject(book);
        System.out.println(output.toJSON());

        output = marshaler.marshalObject(owner);
        System.out.println(output.toJSON());
    }
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.