Package org.apache.wink.json4j

Examples of org.apache.wink.json4j.JSONWriter.object()


    public void test_WriteObjectAttrArray() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");
            jWriter.array();
            jWriter.value(true);
            jWriter.endArray();
            jWriter.endObject();
View Full Code Here


    public void test_WriteObjectAttrJSONObject() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");

            // Verify we can put a JSONObject into the stream!
            JSONObject jObj = new JSONObject();
            jObj.put("foo", true);
View Full Code Here

    public void test_WriteObjectAttrJSONArray() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");

            // Verify we can put a JSONObject into the stream!
            JSONArray jArray = new JSONArray();
            jArray.put(true);
View Full Code Here

    public void test_WriteObjectComplex() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("string");
            jWriter.value("String1");
            jWriter.key("bool");
            jWriter.value(false);
            jWriter.key("number");
View Full Code Here

            jWriter.key("number");
            jWriter.value(1);

            // Place an object
            jWriter.key("object");
            jWriter.object();
            jWriter.key("string");
            jWriter.value("String2");
            jWriter.endObject();

            // Place an array
View Full Code Here

            jWriter.value("String1");
            jWriter.value(false);
            jWriter.value(1);

            // Place an object
            jWriter.object();
            jWriter.key("string");
            jWriter.value("String2");
            jWriter.endObject();

            // Place an array
View Full Code Here

    public void test_ObjectNoKeyValueFail() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.value(true);
            jWriter.endObject();
        }catch(Exception ex1){
            ex = ex1;
        }
View Full Code Here

    public void test_ObjectKeyValueNoKeyValueFail() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");
            jWriter.value(true);
           
            // This should die with IllegalStateException...
            jWriter.value(false);
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.