Examples of Json


Examples of org.mojavemvc.views.JSON

        assertEquals("application/json", json.getContentType());
    }
   
    @Test
    public void toStringAfterObjectConstructorReturnsJSON() {
        JSON json = new JSON(new SimplePojo("test"));
        assertEquals("{\"val\":\"test\"}", json.toString());
    }
View Full Code Here

Examples of org.mortbay.util.ajax.JSON

    String format = request.getParameter("format");
    Collection<MetricsContext> allContexts =
      ContextFactory.getFactory().getAllContexts();
    if ("json".equals(format)) {
      // Uses Jetty's built-in JSON support to convert the map into JSON.
      out.print(new JSON().toJSON(makeMap(allContexts)));
    } else {
      printMap(out, makeMap(allContexts));
    }
    out.close();
  }
View Full Code Here

Examples of org.ofbiz.base.json.JSON

                return convertObject(String.class, new String(buffer, i + 1, length - i - 1), type);
            }
        } catch (Exception e) {
        }
        try {
            return new JSON(new StringReader(new String(buffer, offset, length))).allowResolve(allowJsonResolve).JSONValue();
        } catch (Error e) {
        } catch (Exception e) {
        }
        throw new IOException("Can't read (" + new String(buffer, offset, length) + ")");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.json.model.Json

    }

    @Test
    public void unmarshalJson() throws XMLStreamException, JAXBException {
        String xml = "<json xmlns=\"urn:xmpp:json:0\">{ \"name\": \"romeo\", \"age\": \"421\", \"status\": \"single\" }</json>";
        Json json = unmarshal(xml, Json.class);
        Assert.assertNotNull(json);
        Assert.assertEquals(json.getValue(), "{ \"name\": \"romeo\", \"age\": \"421\", \"status\": \"single\" }");
    }
View Full Code Here

Examples of siena.Json

          if (jsonStr != null && jsonStr.length > 0 && !jsonStr[0].equals("")) {
            try {
              //com.google.gson.JsonParser parser = new com.google.gson.JsonParser();
              //parser.parse(jsonStr[0]);
             
              Json json = Json.loads(jsonStr[0]);
              if(json!=null){
                bw.set(field.getName(), o, json);
                params.remove(name + "." + field.getName());
              }
              else Validation.addError(name+"."+field.getName(), "validation.notParsable");
View Full Code Here

Examples of siena.Json

       
        public Employee(Employee emp){
          this.firstName = emp.firstName;
          this.lastName = emp.lastName;
          this.pwd = emp.pwd;
          this.contactInfo = new Json(emp.contactInfo);
          this.hireDate = emp.hireDate;
          this.fireDate = emp.fireDate;
          this.boss = emp.boss;
          this.enumField = emp.enumField;
          // ...
View Full Code Here

Examples of siena.Json

                f.set(model, objects.get(key).get(f.getName()));
              } else if (f.getType().equals(byte[].class)) {
                                f.set(model, objects.get(key).get(f.getName()));
                            } else if(Json.class.isAssignableFrom(f.getType())){
                              Object obj = objects.get(key).get(f.getName());
                              Json json = new Json(obj);
                  if(json!=null){
                    f.set(model, json);
                  }
                            } else if(f.isAnnotationPresent(Embedded.class) && List.class.isAssignableFrom(f.getType())){
                               Object obj = objects.get(key).get(f.getName());
View Full Code Here

Examples of siena.Json

    assertEquals(2, json.at(1).asInt());
    assertEquals(3, json.at(2).asInt());
  }
 
  public void testRemoveAt() {
    Json json = Json.list(1, 2, 3);
    json.removeAt(1);

    assertEquals(2, json.size());
    assertEquals(1, json.at(0).asInt());
    assertEquals(3, json.at(1).asInt());
  }
View Full Code Here

Examples of siena.Json

    assertEquals(1, json.at(0).asInt());
    assertEquals(3, json.at(1).asInt());
  }
 
  public void testIndexOf() {
    Json json = Json.list(1, 2, 3, "hello", true, false, null);

    assertEquals(0, json.indexOf(1));
    assertEquals(1, json.indexOf(2));
    assertEquals(2, json.indexOf(3));
    assertEquals(3, json.indexOf("hello"));
    assertEquals(4, json.indexOf(true));
    assertEquals(5, json.indexOf(false));
    assertEquals(6, json.indexOf(null));
  }
View Full Code Here

Examples of siena.Json

    assertEquals(5, json.indexOf(false));
    assertEquals(6, json.indexOf(null));
  }
 
  public void testRemoveKey() {
    Json json = Json.map().put("foo", "bar");
    json.remove("foo");
    assertTrue(json.isEmpty());
  }
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.