Package pivot.serialization

Examples of pivot.serialization.JSONSerializer.writeObject()


        a.put("c", c);

        StringWriter writer = new StringWriter();
        JSONSerializer jsonSerializer = new JSONSerializer();
        try {
            jsonSerializer.writeObject(a, writer);
        } catch(Exception exception) {
            System.out.println(exception);
        }

        System.out.println("Output: " + writer);
View Full Code Here


            try {
                System.out.println("Input: " + testStrings[i]);
                Object object = jsonSerializer.readObject(new StringReader(testStrings[i]));
                System.out.println("Object: " + object);
                StringWriter writer = new StringWriter();
                jsonSerializer.writeObject(object, writer);

                System.out.println("Output: " + writer);
            } catch(Exception exception) {
                System.out.println(exception);
            }
View Full Code Here

            System.out.println(JSONSerializer.getString(root, "foo"));
            System.out.println(JSONSerializer.getString(root, "bar"));
        }

        try {
            serializer.writeObject(root, System.out);
        } catch(Exception exception) {
            System.out.println(exception);
        }
    }
View Full Code Here

    private static void testList(String list, String path) {
        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            jsonSerializer.writeObject(JSONSerializer.get(JSONSerializer.parseList(list), path),
                System.out);
            System.out.println();
        } catch(Exception exception) {
            System.out.println(exception);
        }
View Full Code Here

    private static void testMap(String map, String path) {
        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            jsonSerializer.writeObject(JSONSerializer.get(JSONSerializer.parseMap(map), path),
                System.out);
            System.out.println();
        } catch(Exception exception) {
            System.out.println(exception);
        }
View Full Code Here

    public static void test5() {
        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            jsonSerializer.writeObject(JSONSerializer.parse("// This is a comment\n\n['a', /*FOO*/ //dfsdf\n 'b' // FSKJHJKDSF\r /*ASDKHASD*/]"), System.out);
        } catch(Exception exception) {
            System.err.println(exception);
        }
    }

View Full Code Here

        ServletInputStream inputStream = request.getInputStream();
        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            Object value = jsonSerializer.readObject(inputStream);
            jsonSerializer.writeObject(value, System.out);
            response.setStatus(201);
            response.setHeader("Location", request.getPathInfo() +"#101");
        } catch(SerializationException exception) {
            throw new ServletException(exception);
        }
View Full Code Here

        ServletInputStream inputStream = request.getInputStream();
        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            Object value = jsonSerializer.readObject(inputStream);
            jsonSerializer.writeObject(value, System.out);
            response.setStatus(200);
        } catch(SerializationException exception) {
            throw new ServletException(exception);
        }
View Full Code Here

        a.put("c", c);

        StringWriter writer = new StringWriter();
        JSONSerializer jsonSerializer = new JSONSerializer();
        try {
            jsonSerializer.writeObject(a, writer);
        } catch(Exception exception) {
            System.out.println(exception);
        }

        System.out.println("Output: " + writer);
View Full Code Here

            try {
                System.out.println("Input: " + testStrings[i]);
                Object object = jsonSerializer.readObject(new StringReader(testStrings[i]));
                System.out.println("Object: " + object);
                StringWriter writer = new StringWriter();
                jsonSerializer.writeObject(object, writer);

                System.out.println("Output: " + writer);
            } catch(Exception exception) {
                System.out.println(exception);
            }
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.