Examples of JSONObject


Examples of com.threealike.life.thirdparty.org.json.JSONObject

  }
 
  public static final JSONObject getServiceConfig(String serviceLabel) {
    JSONArray services = getConfig().getJSONArray("services");
    for(int i=0; i < services.length(); i++) {
      JSONObject service = services.getJSONObject(i);
      if(service.getString("label").equals(serviceLabel)) {
        return service;
      }
    }
    return null;
  }
View Full Code Here

Examples of com.voyagegames.core.json.JsonObject

    mParser = new JsonParser(log);
  }

  @Test
  public void testParseString_success() {
    final JsonObject obj = mParser.parse(VALID_STRING);

    assertTrue(log.logs.size() == 0);
    assertTrue(obj != null);
    assertTrue(obj.values.size() == 9);
    assertTrue(obj.values.containsKey("firstName"));
View Full Code Here

Examples of com.zaranux.os.server.util.JSONObject

            case '"':
            case '\'':
                return nextString(c);
            case '{':
                back();
                return new JSONObject(this);
            case '[':
            case '(':
                back();
                return new JSONArray(this);
        }
View Full Code Here

Examples of controller.util.JSONObject

       if(!updateSwitch)
         sw = new Switch(dpid);
      
              List<Port> ports = new ArrayList<Port>();
              Map<String, Future<Object>> stats;
            JSONObject descriptionObj = null, aggregateObj = null, portObj = null, featuresObj = null;
                try {
          stats = (Map<String, Future<Object>>) futureStats.get(dpid).get(5L, TimeUnit.SECONDS);
          // Don't bother if we are updating this switch, since description is static
          if(!updateSwitch)
            descriptionObj = (JSONObject)stats.get("description").get(5L, TimeUnit.SECONDS);
          aggregateObj = (JSONObject)stats.get("aggregate").get(5L, TimeUnit.SECONDS);
                  portObj = (JSONObject)stats.get("port").get(5L, TimeUnit.SECONDS);
                  featuresObj = (JSONObject)stats.get("features").get(5L, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (ExecutionException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (TimeoutException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

                // Description stats
                if(!updateSwitch && descriptionObj != null){
                  descriptionObj = descriptionObj.getJSONArray(dpid).getJSONObject(0);
                  sw.setManufacturerDescription(descriptionObj.getString("manufacturerDescription"));
                  sw.setHardwareDescription(descriptionObj.getString("hardwareDescription"));
                  sw.setSoftwareDescription(descriptionObj.getString("softwareDescription"));
                  sw.setSerialNumber(descriptionObj.getString("serialNumber"));
                  sw.setDatapathDescription(descriptionObj.getString("datapathDescription"));
              
               
                // Aggregate stats, ignore
                if(aggregateObj != null){
                    aggregateObj = aggregateObj.getJSONArray(dpid).getJSONObject(0);
                    sw.setPacketCount(String.valueOf(aggregateObj.getInt("packetCount")));
                    sw.setByteCount(String.valueOf(aggregateObj.getInt("byteCount")));
                    sw.setFlowCount(String.valueOf(aggregateObj.getInt("flowCount")));
                }
               
                // Flow Stats
                sw.setFlows(FlowJSON.getFlows(dpid));
               
                // Port and Features stats
                JSONArray json = portObj.getJSONArray(sw.getDpid());
                JSONObject objtwo = featuresObj.getJSONObject(sw.getDpid());
                JSONArray jsontwo = objtwo.getJSONArray("ports");
                for(int i = 0; i < json.length(); i++)
                {
                    obj = (JSONObject)json.get(i);
                    Port port = new Port(String.valueOf(obj.getInt("portNumber")));
                    port.setReceivePackets(FormatLong.formatPackets(obj.getLong("receivePackets"), false, false));
View Full Code Here

Examples of elemental.json.JsonObject

    public void write(UI ui, Writer writer) throws IOException {

        Collection<ClientConnector> dirtyVisibleConnectors = ui
                .getConnectorTracker().getDirtyVisibleConnectors();

        JsonObject hierarchyInfo = Json.createObject();
        for (ClientConnector connector : dirtyVisibleConnectors) {
            String connectorId = connector.getConnectorId();
            JsonArray children = Json.createArray();

            for (ClientConnector child : AbstractClientConnector
                    .getAllChildrenIterable(connector)) {
                if (LegacyCommunicationManager
                        .isConnectorVisibleToClient(child)) {
                    children.set(children.length(), child.getConnectorId());
                }
            }
            try {
                hierarchyInfo.put(connectorId, children);
            } catch (JsonException e) {
                throw new PaintException(
                        "Failed to send hierarchy information about "
                                + connectorId + " to the client: "
                                + e.getMessage(), e);
View Full Code Here

Examples of external.JSON.JSONObject

            }

            // Provide a listing of all of the metadata files for all of
            // the games, on request.
            if (reqURI.equals("/games/metadata")) {
                JSONObject theGameMetaMap = new JSONObject();
                for (String gameName : new File("games", "games").list()) {
                  if (shouldIgnoreFile(gameName)) continue;
                    try {
                        theGameMetaMap.put(gameName, new JSONObject(new String(getResponseBytesForURI("/games/" + gameName + "/"))));
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
                return theGameMetaMap.toString().getBytes();
            }

            // Accessing the folder containing a game should show the game's
            // associated metadata (which includes the contents of the folder).
            if(reqURI.endsWith("/") && reqURI.length() > 9) {
View Full Code Here

Examples of facebook4j.internal.org.json.JSONObject

    private Integer unread;
    private Integer unseen;

    /*package*/MessageJSONImpl(HttpResponse res, Configuration conf) throws FacebookException {
        super(res);
        JSONObject json = res.asJSONObject();
        init(json);
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.clearThreadLocalMap();
            DataObjectFactoryUtil.registerJSONObject(this, json);
        }
View Full Code Here

Examples of fi.luomus.commons.json.JSONObject

 
  @Test
  public void contentAsJson() throws ClientProtocolException, IOException {
    client = new HttpClientService();
    HttpGet request = new HttpGet("http://ws.luomus.fi/util/coordinate-conversion-service?lat=6663841&lon=333229&type=trs-tm35fin&format=json");
    JSONObject json = client.contentAsJson(request);
    Assert.assertEquals(1, json.getKeys().length);
    Assert.assertEquals("conversion-response", json.getKeys()[0]);
  }
View Full Code Here

Examples of io.vertx.core.json.JsonObject

        JerseyOptions options = new DefaultJerseyOptions(null);
        When when = WhenFactory.createSync();

        DefaultWhenJerseyServer whenJerseyServer = new DefaultWhenJerseyServer(vertx, server, options, when);

        JsonObject config = new JsonObject()
                .put("host", host)
                .put("port", port)
                .put("resources", new JsonArray().add("com.englishtown.vertx.jersey.promises.integration.resources"));

        CountDownLatch latch = new CountDownLatch(1);
View Full Code Here

Examples of javax.json.JsonObject

    @Test
    public void testJSON() {
        Response response = getResource(resourceURL, APPLICATION_JSON_TYPE);

        JsonObject content = response.readEntity(JsonObject.class);
        System.out.println(content);

        assertTrue(content.containsKey("result"));
        assertEquals("Hello World!", content.getString("result"));
    }
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.