Package org.json.simple

Examples of org.json.simple.JSONObject.entrySet()


        /*parse the json object */
        JSONParser parser = new JSONParser();
        JSONObject obj = (JSONObject) parser.parse(jsonString);

        Set<Entry<String, Object>> entries = obj.entrySet();
        for (Entry<String, Object> entry : entries) {

            String key = entry.getKey();
            Object value = entry.getValue();

View Full Code Here


        /*parse the json object */
        JSONParser parser = new JSONParser();
        JSONObject obj = (JSONObject) parser.parse(jsonString);

        Set<Entry<String, Object>> entries = obj.entrySet();
        for (Entry<String, Object> entry : entries) {

            String key = entry.getKey();
            Object value = entry.getValue();

View Full Code Here

        /*parse the json object */
        JSONParser parser = new JSONParser();
        JSONObject obj = (JSONObject) parser.parse(jsonString);

        Set<Entry<String, Object>> entries = obj.entrySet();
        for (Entry<String, Object> entry : entries) {

            String key = entry.getKey();
            Object value = entry.getValue();

View Full Code Here

        /*parse the json object */
        JSONParser parser = new JSONParser();
        JSONObject obj = (JSONObject) parser.parse(jsonString);

        Set<Entry<String, Object>> entries = obj.entrySet();
        for (Entry<String, Object> entry : entries) {

            String key = entry.getKey();
            Object value = entry.getValue();

View Full Code Here

        JSONParser parser = new JSONParser();
        ByteArrayInputStream is = new ByteArrayInputStream(pData,0,pLength);
        try {
            JSONObject inMsg = (JSONObject) parser.parse(new InputStreamReader(is, "UTF-8"));
            Map<Payload, Object> data = new HashMap<Payload, Object>();
            for (Map.Entry entry : (Set<Map.Entry>) inMsg.entrySet()) {
                try {
                    data.put(Payload.fromKey(entry.getKey().toString()), entry.getValue());
                } catch (IllegalArgumentException exp) {
                    // We simply ignore key which are unknown
                }
View Full Code Here

        /*parse the json object */
        JSONParser parser = new JSONParser();
        JSONObject obj = (JSONObject) parser.parse(jsonString);

        Set<Entry<String, Object>> entries = obj.entrySet();
        for (Entry<String, Object> entry : entries) {

            String key = entry.getKey();
            Object value = entry.getValue();

View Full Code Here

                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                conn.setRequestMethod("GET");
                assertEquals(HttpServletResponse.SC_OK, conn.getResponseCode());
                assertTrue(conn.getHeaderField("content-type").startsWith(RestConstants.JSON_CONTENT_TYPE));
                JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(conn.getInputStream()));
                assertEquals(1, json.entrySet().size());
                return null;
            }
        });
    }
View Full Code Here

                return createWorkflowAction((JSONObject) obj);
            }
            else if (type == Properties.class){
                JSONObject jsonMap = (JSONObject)JSONValue.parse((String)obj);
                Properties props = new Properties();
                Set<Map.Entry> entrySet = jsonMap.entrySet();
                for (Map.Entry jsonEntry: entrySet){
                    props.put(jsonEntry.getKey(), jsonEntry.getValue());
                }
                return props;
            }
View Full Code Here

                return createWorkflowAction((JSONObject) obj);
            }
            else if (type == Properties.class){
                JSONObject jsonMap = (JSONObject)JSONValue.parse((String)obj);
                Properties props = new Properties();
                Set<Map.Entry> entrySet = jsonMap.entrySet();
                for (Map.Entry jsonEntry: entrySet){
                    props.put(jsonEntry.getKey(), jsonEntry.getValue());
                }
                return props;
            }
View Full Code Here

            throw new SerializationException("Unsupported data type for Point");
        }

        // Set all filtered stats to null if numPoints is 0
        if (numPoints == 0) {
            final Set<Map.Entry<String, Object>> statsSet = filterStatsObject.entrySet();

            for (Map.Entry<String, Object> stat : statsSet) {
                if (!stat.getKey().equals("numPoints")) {
                    stat.setValue(null);
                }
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.