Examples of Json


Examples of net.sf.json.JSON

        }
        return JSONObject.fromObject(obj, config);
    }

    public String toXML(Object obj) {
        JSON json = _toJson(obj);
        XMLSerializer xmlSerializer = new XMLSerializer();
        return xmlSerializer.write(json);
    }
View Full Code Here

Examples of net.sf.json.JSON

    public JSONArray paramAsJSONArray(String key) {
        return JSONArray.fromObject(param(key));
    }

    public JSONObject paramAsJSON() {
        JSON json = _contentAsJSON();
        if (json.isArray()) {
            throw new ArgumentErrorException("数据格式错误,您需要传入json格式");
        }
        return (JSONObject) json;
    }
View Full Code Here

Examples of net.sf.json.JSON

        }
        return (JSONObject) json;
    }

    public JSONArray paramsAsJSONArray() {
        JSON json = _contentAsJSON();
        if (!json.isArray()) throw new ArgumentErrorException("数据格式错误,您需要传入json格式");
        return (JSONArray) json;
    }
View Full Code Here

Examples of net.sf.json.JSON

        }

    }

    public JSONArray paramAsXMLArray() {
        JSON json = _contentAsXML();
        if (!json.isArray()) throw new ArgumentErrorException("数据格式错误,您需要传入json格式");
        return (JSONArray) json;
    }
View Full Code Here

Examples of net.sf.json.JSON

        if (!json.isArray()) throw new ArgumentErrorException("数据格式错误,您需要传入json格式");
        return (JSONArray) json;
    }

    public JSONObject paramAsXML() {
        JSON json = _contentAsXML();
        if (json.isArray()) {
            throw new ArgumentErrorException("数据格式错误,您需要传入json格式");
        }
        return (JSONObject) json;
    }
View Full Code Here

Examples of net.sf.json.JSON

    }

    private JSON _contentAsXML() {
        try {
            XMLSerializer xmlSerializer = new XMLSerializer();
            JSON json = xmlSerializer.read(contentAsString());
            return json;
        } catch (Exception e) {
            throw new ArgumentErrorException("数据格式错误,您需要传入json格式");
        }
    }
View Full Code Here

Examples of net.sf.json.JSON

            }
            result.put("result", variables);
        }

        ServletOutputStream outputStream = response.getOutputStream();
        JSON json = JSONSerializer.toJSON(result);
        outputStream.print(json.toString());
        outputStream.flush();
    }
View Full Code Here

Examples of net.sf.json.JSON

    @Test
    public void testUnmarshalJSONObject() throws Exception {
        InputStream inStream = getClass().getResourceAsStream("testMessage1.json");
        String in = context.getTypeConverter().convertTo(String.class, inStream);
        JSON json = JSONSerializer.toJSON(in);

        MockEndpoint mockXML = getMockEndpoint("mock:xml");
        mockXML.expectedMessageCount(1);
        mockXML.message(0).body().isInstanceOf(String.class);
View Full Code Here

Examples of org.apache.openjpa.json.JSON

    }

    public void encode(Object obj, JPAServletContext ctx) {
        if (obj instanceof OpenJPAStateManager) {
            try {
                JSON result = encodeManagedInstance((OpenJPAStateManager)obj,
                    ctx.getPersistenceContext().getMetamodel());
                PrintWriter writer = ctx.getResponse().getWriter();
                writer.println(result.toString());
            } catch (Exception e) {
                throw new ProcessingException(ctx, e);
            }
        } else {
            throw new RuntimeException(this + " does not know how to encode " + obj);
View Full Code Here

Examples of org.apache.struts2.json.annotations.JSON

            return name;
        }


        public JSONAnnotationFinder invoke() {
            JSON json = accessor.getAnnotation(JSON.class);
            serialize = json.serialize();
            if (serialize && json.name().length() > 0) {
                name = json.name();
            }
            return this;
        }
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.