Examples of JSONArray


Examples of org.apache.wink.json4j.JSONArray

    private boolean flightAlreadyBooked(String flightId, String userId) {
        JSONObject myFlightsObj = MyFlights.getInstance().getMyFlights(userId);
        if(myFlightsObj.has("myflights")) {
            try {
                JSONArray myFlights = myFlightsObj.getJSONArray("myflights");
                Iterator<JSONObject> iter = myFlights.iterator();
                while(iter.hasNext()) {
                    if(iter.next().getString(FLIGHT_ID).equals(flightId)) {
                        return true;
                    }
                }
View Full Code Here

Examples of org.apache.wink.json4j.compat.JSONArray

            JSONStringer jStringer = factory.createJSONStringer();
            jStringer.array();
            jStringer.endArray();
            String str = jStringer.toString();
            // Verify it parses.
            JSONArray test = factory.createJSONArray(str);
            assertTrue(str.equals("[]"));
        }catch(Exception ex1){
            ex = ex1;
            ex.printStackTrace();
        }
View Full Code Here

Examples of org.auto.json.JsonArray

  /** ~~~~~~~~~~~~~~~~~~~~~~~推送消息~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  /**
   * 将消息用指定的writer发送
   * */
  private void pushMessage(List<String> messages, PrintWriter writer) {
    JsonArray array = new JsonArray();
    boolean isClose = false;
    for (String message : messages) {
      if (isCloseMessage(message)) {
        isClose = true;
      }
      array.add(message);
    }
    writer.write(array.toString());
    writer.flush();
    // 如果发送的消息中有关闭消息,则真正关闭连接
    if (isClose) {
      reallyClose();
    }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.util.json.JSONArray

  @Test
  @SuppressWarnings("unchecked")
  public void testJsonArrayToList() {
    assertNull(jsonArrayAsList(null));

    JSONArray jsonArray = new JSONArray();

    List<Object> list = jsonArrayAsList(jsonArray);
    assertTrue(list.isEmpty());

    jsonArray.put(true);
    jsonArray.put(12);
    jsonArray.put(11.1);
    jsonArray.put(13l);
    jsonArray.put("test");
    jsonArray.put(Collections.singletonList("test"));
    jsonArray.put(Collections.singletonMap("test", "test"));
    jsonArray.put(new Date(0));

    list = jsonArrayAsList(jsonArray);
    assertEquals(8, list.size());

    assertEquals(true, list.get(0));
View Full Code Here

Examples of org.codehaus.groovy.grails.web.json.JSONArray

  public static Map<String, Object> doSearchAll(String url, Integer connectionTimeout, Integer soTimeout)
  {
    Map<String, Object> resp = getJSON(url, connectionTimeout, soTimeout);
    if (!resp.containsKey("exception"))
      resp.put("response", MapUtil.jsonArrayToList(new JSONArray((String) resp.get("response"))));
    return resp;
  }
View Full Code Here

Examples of org.codehaus.jettison.json.JSONArray

    //public JSONObject getUser(@PathParam("userid") String userid) throws JSONException, Exception {
       public JSONArray getUsers() throws JSONException, Exception {
      logger.finer(" get USERs is here !");
      mf = (ModelFacade)getServletContext().getAttribute(WebConstants.MF_KEY);
      List<Person> allUsers = mf.getAllPersons();
       JSONArray uriArray = new JSONArray();
        for (Person userEntity : allUsers) {
            UriBuilder ub = uriInfo.getAbsolutePathBuilder();
            URI userUri = ub.
                    path(userEntity.getUserName()).
                    build();
            uriArray.put(userUri.toASCIIString());
        }
        return uriArray;

  }
View Full Code Here

Examples of org.eclipse.rap.json.JsonArray

  @Test
  public void testCanFindCapabilities() {
    ClientDeviceImpl deviceImpl = new ClientDeviceImpl();
    JsonObject properties = new JsonObject();
    JsonArray jsonArray = new JsonArray();
    jsonArray.add( "CAMERA" );
    jsonArray.add( "LOCATION" );
    properties.add( "capabilities", jsonArray );

    environment.dispatchSetOnServiceObject( properties );

    assertTrue( deviceImpl.hasCapability( Capability.LOCATION ) );
View Full Code Here

Examples of org.eclipse.rap.rwt.internal.theme.JsonArray

    resp.getWriter().write( jsonObject.toString() );
  }

  private JsonObject createMessageObject( Collection<String> servletPaths ) {
    JsonObject jsonObject = new JsonObject();
    JsonArray array = new JsonArray();
    appendPaths( servletPaths, array );
    jsonObject.append( KEY_ENTRYPOINTS, array );
    return jsonObject;
  }
View Full Code Here

Examples of org.hornetq.utils.json.JSONArray

      ClientConsumer consumer = session.createConsumer(queue);
      Assert.assertEquals(1, queueControl.getConsumerCount());

      System.out.println("Consumers: " + queueControl.listConsumersAsJSON());

      JSONArray obj = new JSONArray(queueControl.listConsumersAsJSON());

      assertEquals(1, obj.length());

      consumer.close();
      Assert.assertEquals(0, queueControl.getConsumerCount());

      obj = new JSONArray(queueControl.listConsumersAsJSON());

      assertEquals(0, obj.length());

      session.deleteQueue(queue);
   }
View Full Code Here

Examples of org.jcoredb.service.http.output.JSONArray

   
    JSONAttribute path = new JSONAttribute("path", fs.getPath(), AttrType.String);
   
    root.add(path);
   
    JSONArray childs = new JSONArray("containers");
   
    for (int i = 0; i < cs.length; i++)
    {
       IContainer c = cs[i];
      
       JSONNode child = new JSONNode();
       JSONAttribute id = new JSONAttribute("id", ""+c.getId(), AttrType.Number);
       child.add(id);
      
       childs.add(child);
    }
   
    root.add(childs);
   
    out.println(root.toJSONString());
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.