Examples of JsonElement


Examples of com.google.gson.JsonElement

    private static final Pattern DATETIME = Pattern.compile(
            "(\\d{3,})-(\\d{1,2})-(\\d{1,2})\\s+(\\d{1,2}):(\\d{1,2}):(\\d{1,2})");
    @Override
    public void datetimeProperty(PropertyName name, JsonObject context) throws IOException {
        JsonElement prop = property(context, name);
        if (prop == null) {
            return;
        }
        String string = prop.getAsString();
        Matcher matcher = DATETIME.matcher(string);
        if (matcher.matches() == false) {
            throw new IOException(MessageFormat.format(
                    "invalid time property \"{0}\", must be \"{2}\" form, but was \"{1}\"",
                    name,
View Full Code Here

Examples of com.google.gson.JsonElement

        InputStream input = entity.getContent();
        try {
            Reader reader = new BufferedReader(new InputStreamReader(input, ENCODING));
            JsonParser parser = new JsonParser();
            JsonElement element = parser.parse(reader);
            if ((element instanceof JsonObject) == false) {
                throw new IOException(MessageFormat.format(
                        "Response message was not a valid json object: {0} ({1})",
                        request.getURI(),
                        response.getStatusLine()));
View Full Code Here

Examples of com.massivecraft.mcore.xlib.gson.JsonElement

      boolean hasComplexKeys = false;
      List<JsonElement> keys = new ArrayList<JsonElement>(map.size());

      List<V> values = new ArrayList<V>(map.size());
      for (Map.Entry<K, V> entry : map.entrySet()) {
        JsonElement keyElement = toJsonTree(keyTypeAdapter, entry.getKey());
        keys.add(keyElement);
        values.add(entry.getValue());
        hasComplexKeys |= keyElement.isJsonArray() || keyElement.isJsonObject();
      }

      if (hasComplexKeys) {
        out.beginArray();
        for (int i = 0; i < keys.size(); i++) {
          out.beginArray(); // entry array
          Streams.write(keys.get(i), out);
          valueTypeAdapter.write(out, values.get(i));
          out.endArray();
        }
        out.endArray();
      } else {
        out.beginObject();
        for (int i = 0; i < keys.size(); i++) {
          JsonElement keyElement = keys.get(i);
          out.name(keyToString(keyElement));
          valueTypeAdapter.write(out, values.get(i));
        }
        out.endObject();
      }
View Full Code Here

Examples of net.minecraft.util.com.google.gson.JsonElement

    public void a(JsonElement jsonelement) {
        if (jsonelement.isJsonArray()) {
            Iterator iterator = jsonelement.getAsJsonArray().iterator();

            while (iterator.hasNext()) {
                JsonElement jsonelement1 = (JsonElement) iterator.next();

                this.add(jsonelement1.getAsString());
            }
        }
    }
View Full Code Here

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

        }
        throw new Error("Missing return statement in function");
    }

    final public JSONElement parseJSON() throws ParseException {
        JSONElement json = null;
        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
            case 20:
                json = JsonObject();
                break;
            case 25:
View Full Code Here

Examples of org.sourceforge.jsonedit.core.outline.elements.JsonElement

   
    IDocument doc = FileToDocUtility.getDocument(System.getProperty("user.dir") + "/resources/testfiles/test4.json");
    doc.addPositionCategory(JSON_ELEMENTS);
    JsonTextOutlineParser jtop = new JsonTextOutlineParser(doc);
   
    JsonElement top = (JsonElement) jtop.parse();
   
    Assert.assertEquals(3, top.getChildren().size());
   
    JsonElement response = top.getChildren().get(2);
   
    Assert.assertEquals(1, response.getChildren().size());
   
    JsonElement representations = response.getChildren().get(0);
   
    Assert.assertEquals(2, representations.getChildren().size());
   
    JsonElement meta = representations.getChildren().get(0);
   
    Assert.assertEquals(4, meta.getChildren().size());
   
    JsonElement entries = meta.getChildren().get(1);
   
    Assert.assertEquals(4, entries.getChildren().size());
   
    JsonElement entries2 = meta.getChildren().get(2);
   
    Assert.assertEquals(4, entries2.getChildren().size());
   
    JsonElement entries3 = meta.getChildren().get(3);
   
    Assert.assertEquals(4, entries3.getChildren().size());
   
  }
View Full Code Here

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

  public ChangeAwareJsonArray getArray(String fieldName) {
      return convertJsonArray(inner.getArray(fieldName));
    }

  public ChangeAwareJsonElement getElement(String fieldName) {
      JsonElement value = inner.getElement(fieldName);
      if (value.isArray()) {
        return convertJsonArray(value.asArray());
      } else {
        return convertJsonObject(value.asObject());
      }
    }
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.