Examples of JSONObject


Examples of org.unidal.webres.json.JsonObject

    return builder.toString();
  }

  public String parseDomain(String content) throws Exception {
    JsonObject object = new JsonObject(content);
    JsonArray projectArray = object.getJSONArray("projects");

    if (projectArray.length() > 0) {
      JsonObject firstProject = projectArray.getJSONObject(0);
      return firstProject.get("project_name").toString();
    }
    return null;
  }
View Full Code Here

Examples of org.vertx.java.core.json.JsonObject

  private void handleDbMongo(final HttpServerRequest req) {
    findRandom(ThreadLocalRandom.current(), new Handler<Message<JsonObject>>() {
      @Override
      public void handle(Message<JsonObject> reply) {
        JsonObject world = getResultFromReply(reply);
        String result = world.encode();
        sendResponse(req, result);
      }
    });
  }
View Full Code Here

Examples of org.zkforge.json.simple.JSONObject

    static DecimalFormat static_nf = new DecimalFormat(".####");

    @SuppressWarnings("unchecked")
    public String toString()
    {
        JSONObject json = new JSONObject();
        json.put("id", String.valueOf(getId()));
        TimeZone zone = Calendar.getInstance().getTimeZone();
        timeformat.setTimeZone(zone);
        String formattedTime = timeformat.format(getTime());
        json.put("time", formattedTime);
        if (getValue() < 0)
        {
            json.put("value", "NaN");
        }
        else
        {
            json.put("value", static_nf.format(getValue()));
        }
//        if (getReliability() < 0)
//        {
//            json.put("reliability", "NaN");
//        }
//        else
//        {
//            json.put("reliability", static_nf.format(getReliability()));
//        }
//        System.out.println(json.toString());
        return json.toString();
    }
View Full Code Here

Examples of org.zkoss.json.JSONObject

 
 
  @SuppressWarnings("unchecked")
  @Override
  public JSONAware getShapeJSONObject() {
    JSONObject result = new JSONObject();
    result.put("cnt", getSnapshotCntRef());
   
    result.put("dx", _dx);
    result.put("dy", _dy);
   
    if(_dw >= 0 && _dh >= 0) {
      result.put("dw", _dw);
      result.put("dh", _dh);
    }
   
    if(_sx >= 0 && _sy >= 0 && _sw >= 0 && _sh >= 0) {
      result.put("sx", _sx);
      result.put("sy", _sy);
      result.put("sw", _sw);
      result.put("sh", _sh);
    }
   
    return result;
  }
View Full Code Here

Examples of restx.build.org.json.JSONObject

* Time: 2:08 PM
*/
public class MavenSupport implements RestxBuild.Parser, RestxBuild.Generator {
    static class Parser {
        public ModuleDescriptor parse(InputStream stream) throws IOException {
            JSONObject jsonObject = XML.toJSONObject(RestxBuildHelper.toString(stream)).getJSONObject("project");

            GAV parent;
            if (jsonObject.has("parent")) {
                JSONObject parentObject = jsonObject.getJSONObject("parent");
                parent = getGav(parentObject);
            } else {
                parent = null;
            }
            GAV gav = getGav(jsonObject);
            String packaging = jsonObject.has("packaging") ? jsonObject.getString("packaging") : "jar";

            Map<String, String> properties = new LinkedHashMap<>();
            if (jsonObject.has("properties")) {
                JSONObject props = jsonObject.getJSONObject("properties");
                for (Object o : props.keySet()) {
                    String p = (String) o;

                    if (p.equals("maven.compiler.target") || p.equals("maven.compiler.source")) {
                        properties.put("java.version", String.valueOf(props.get(p)));
                    } else {
                        properties.put(p, String.valueOf(props.get(p)));
                    }
                }
            }

            Map<String, List<ModuleDependency>> dependencies = new LinkedHashMap<>();

            if (jsonObject.has("dependencies")) {
                JSONArray deps = jsonObject.getJSONObject("dependencies").getJSONArray("dependency");

                for (int i = 0; i < deps.length(); i++) {
                    JSONObject dep = deps.getJSONObject(i);
                    String scope = dep.has("scope") ? dep.getString("scope") : "compile";

                    List<ModuleDependency> scopeDependencies = dependencies.get(scope);
                    if (scopeDependencies == null) {
                        dependencies.put(scope, scopeDependencies = new ArrayList<>());
                    }
View Full Code Here

Examples of se.llbit.json.JsonObject

    atmosphereEnabled = desc.get("atmosphereEnabled").boolValue(false);
    volumetricFogEnabled = desc.get("volumetricFogEnabled").boolValue(false);
    waterHeight = desc.get("waterHeight").intValue(0);

    // load world info
    JsonObject world = desc.get("world").object();
    worldPath = world.get("path").stringValue("");
    worldDimension = world.get("dimension").intValue(0);

    camera.fromJson(desc.get("camera").object());
    sun.fromJson(desc.get("sun").object());
    sky.fromJson(desc.get("sky").object());
View Full Code Here

Examples of se.sics.json.JSONObject

            } else if (c == '{') {
                brackets++;
            } else if (c == '}') {
                brackets--;
                if (brackets == 0) {
                    JSONObject json = JSONObject.parseJSONObject(sb.toString());
                    sb.setLength(0);
                    if (!handleMessage(json)) {
                        // This connection should no longer be kept alive
                        break;
                    }
View Full Code Here

Examples of twitter4j.JSONObject

    Preconditions.checkNotNull(eventName);
    Preconditions.checkNotNull(target);
    Preconditions.checkNotNull(source);
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("event", eventName);
    map.put("target", new JSONObject(target));
    map.put("source", new JSONObject(source));
    if (targetObject != null) {
      map.put("target_object", new JSONObject(targetObject));
    }
    return new JSONObject(map);
  }
View Full Code Here

Examples of twitter4j.internal.org.json.JSONObject

    }

    private void decode(String str) {
        if (str != null && str.startsWith("{")) {
            try {
                JSONObject json = new JSONObject(str);
                if (!json.isNull("error")) {
                    this.errorMessage = json.getString("error");
                }
                if (!json.isNull("request")) {
                    this.requestPath = json.getString("request");
                }
            } catch (JSONException ignore) {
            }
        }
    }
View Full Code Here

Examples of twitter4j.org.json.JSONObject

    }

    public Status(String str) throws TwitterException, JSONException {
        // StatusStream uses this constructor
        super();
        JSONObject json = new JSONObject(str);
        id = json.getLong("id");
        text = json.getString("text");
        source = json.getString("source");
        createdAt = parseDate(json.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy");

        inReplyToStatusId = getLong("in_reply_to_status_id", json);
        inReplyToUserId = getInt("in_reply_to_user_id", json);
        isFavorited = getBoolean("favorited", json);
        user = new User(json.getJSONObject("user"));
    }
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.