Package cc.plural.jsonij

Examples of cc.plural.jsonij.JSON


     * Test of getStringReader method, of class JSONReader.
     */
    @Test
    public void testParseEquals() throws IOException, ParserException {
        System.out.println("testParseEquals");
        JSON parseJSON = JSON.parse(googleJSONExample);

        JSON resultParsed = JSON.parse(parseJSON.toJSON());
        assertEquals(parseJSON, resultParsed);

    }
View Full Code Here


        System.out.println("testMedia1");
        for (int i = 0; i < 1; i++) {

            URL file = ClassLoader.class.getResource("/jvmtests/media.1.cks");

            JSON resultJSON = JSON.parse(file.openStream());

            String resultString = resultJSON.toString();
        }
    }
View Full Code Here

        }

        String jsonString = result.toString();

        for (int i = 0; i < 10000; i++) {
            JSON mediaContentJsonObject = JSON.parse(jsonString);

            JSON.Object mediaJsonObject = (JSON.Object) mediaContentJsonObject.get("media");
            Media media = readMedia(mediaJsonObject);

            JSON.Array<Value> imageValues = (JSON.Array<Value>) mediaContentJsonObject.get("images");
            List<Image> images = readImages(imageValues);

            MediaContent mediaContent = new MediaContent();
            mediaContent.media = media;
            mediaContent.images = images;
View Full Code Here

        media.width = mediaJsonObject.get("width").getInt();
        return media;
    }

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

        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

        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

        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

public class JPathAllPredicateTest {

    @Test
    public void testExpression1() throws IOException, ParserException {
        System.out.println("Test Expression1 - All Predicate JPath");
        JSON json = JSON.parse(JSONTestExamples.STORE_SAMPLE);
        JPath<Component> path = JPath.parse("/store/book[*]/author");
        Value[] values = path.evaluateAll(json);
        System.out.println("ResultSize:" + values.length);
        for(int i=0;i<values.length;i++) {
            System.out.println("[" + i + "]" + values[i].toJSON());
View Full Code Here

                + "      \"price\": 19.95\r\n"
                + "    },\r\n"
                + "    \"number\": " + randomDoubleArray.toString() + ""
                + "  }\r\n"
                + "}";
        JSON json = JSON.parse(jsonString);
        System.out.println(json.getRoot().getValueType() + "(" + json.getRoot().nestedSize() + "): " + json.getRoot().toJSON());

        JPathParser jPathParser = new JPathParser();
        JPath<?> path1 = jPathParser.parse("/store");
        path1.setRecordEvaluateTime(true);
        Value value = path1.evaluate(json);
View Full Code Here

    }

    @Test
    public void testExpression0() throws IOException, ParserException {
        System.out.println("Test Expression0 - Single Expression Query - String and Double equals");
        JSON json = JSON.parse(JSONTestExamples.STORE_SAMPLE);

        JPathParser jPathParser = new JPathParser();
        JPath<?> path1 = jPathParser.parse("/store");
        path1.setRecordEvaluateTime(true);
        Value value1 = path1.evaluate(json);
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.