Package org.codehaus.jettison.json

Examples of org.codehaus.jettison.json.JSONObject.keys()


    public static Map<String, Object> parseJSON(String jsonBody) throws JSONException {

        Map<String, Object> params = new HashMap<String, Object>();
        JSONObject obj = new JSONObject(jsonBody);
        Iterator it = obj.keys();
        while (it.hasNext()) {
            Object o = it.next();
            if (o instanceof String) {
                String key = (String)o;
                params.put(key, obj.get(key));
View Full Code Here


    public static Map<String, Object> parseJSON(String jsonBody) throws JSONException {

        Map<String, Object> params = new HashMap<String, Object>();
        JSONObject obj = new JSONObject(jsonBody);
        Iterator it = obj.keys();
        while (it.hasNext()) {
            Object o = it.next();
            if (o instanceof String) {
                String key = (String)o;
                params.put(key, obj.get(key));
View Full Code Here

            return null;
        }
        Map<String, T> result = new HashMap<String, T>();

        JSONObject sourceMap = new JSONObject(jsonObjectVal);
        Iterator<String> keyIterator = sourceMap.keys();
        while (keyIterator.hasNext()) {
            String key = keyIterator.next();
            result.put(key, (T)sourceMap.get(key));
        }
        return result;
View Full Code Here

            Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> headers,
            InputStream in) throws IOException {
        HashMap map = new HashMap();
        try {
            JSONObject obj = new JSONObject(inputStreamAsString(in));
            Iterator  iter=obj.keys();

            while (iter.hasNext()){
                String k = (String) iter.next();
                map.put(k, ""+obj.get(k));
             
View Full Code Here

    public Transition parse(JSONObject json) throws JSONException {
    final int id = json.getInt("id");
        final String name = json.getString("name");
    final JSONObject fieldsObj = json.getJSONObject("fields");
    final Iterator keys = fieldsObj.keys();
    final Collection<Transition.Field> fields = Lists.newArrayList();
    while(keys.hasNext()) {
      final String fieldId = keys.next().toString();
      fields.add(transitionFieldJsonParser.parse(fieldsObj.getJSONObject(fieldId), fieldId));
    }
View Full Code Here

      avatarUris.put(User.S48_48, avatarUri);
    } else {
      // JIRA 5.0+
      final JSONObject avatarUrlsJson = json.getJSONObject("avatarUrls");
      @SuppressWarnings("unchecked")
      final Iterator<String> iterator = avatarUrlsJson.keys();
      while (iterator.hasNext()) {
        final String key = iterator.next();
        avatarUris.put(key, JsonParseUtil.parseURI(avatarUrlsJson.getString(key)));
      }
    }
View Full Code Here

        }
        final Map<String, String> namesMap = parseNames(names);
        final Map<String, String> typesMap = parseSchema(types);

    @SuppressWarnings("unchecked")
    final Iterator<String> iterator = json.keys();
    while (iterator.hasNext()) {
      final String key = iterator.next();
      try {
        if (SPECIAL_FIELDS.contains(key)) {
          continue;
View Full Code Here

        if (jsonObject.has("transitions")) {
          return JsonParseUtil.parseJsonArray(jsonObject.getJSONArray("transitions"), transitionJsonParserV5);
        } else {
          final Collection<Transition> transitions = new ArrayList<Transition>(jsonObject.length());
          @SuppressWarnings("unchecked")
          final Iterator<String> iterator = jsonObject.keys();
          while (iterator.hasNext()) {
            final String key = iterator.next();
            try {
              final int id = Integer.parseInt(key);
              final Transition transition = transitionJsonParser.parse(jsonObject.getJSONObject(key), id);
View Full Code Here

                .generate(transitionInput.getComment()));
          }
        }
        final Iterable<FieldInput> fields = transitionInput.getFields();
                JSONObject fieldsJs = new IssueUpdateJsonGenerator().generate(fields);
        if (fieldsJs.keys().hasNext()) {
          jsonObject.put("fields", fieldsJs);
        }
        final WebResource issueResource = client.resource(transitionsUri);
        issueResource.post(jsonObject);
        return null;
View Full Code Here

            @Override
            public Void call() throws Exception {
                JSONObject jsonObject = new JSONObject();
                final  WebResource issueResource = client.resource(issue.getSelf());
                JSONObject fieldsJs = new IssueUpdateJsonGenerator().generate(fields);
                if (fieldsJs.keys().hasNext()) {
                    jsonObject.put("fields", fieldsJs);
                }
                issueResource.put(jsonObject);
                return 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.