Package com.google.gson

Examples of com.google.gson.JsonParser


                new TypeToken<Collection<Page>>() {
                }.getType());
    }

    private String jsonMember(String entity, String memberName) {
        return new JsonParser().parse(entity).getAsJsonObject().get(memberName).toString();
    }
View Full Code Here


      return entity;
    }
  }

  private String jsonMember(String entity, String memberName) {
    return new JsonParser().parse(entity).getAsJsonObject().get(memberName)
        .toString();
  }
View Full Code Here

            double choice = r.nextDouble();
            try { // Super catch-all to ensure the launcher always renders
                try {
                    // Fetch the percentage json first
                    String json = IOUtils.toString(new URL(Locations.masterRepo + "/FTB2/static/balance.json"));
                    JsonElement element = new JsonParser().parse(json);

                    if (element != null && element.isJsonObject()) {
                        JsonObject jso = element.getAsJsonObject();
                        if (jso != null && jso.get("minUsableLauncherVersion") != null) {
                            LaunchFrame.getInstance().minUsable = jso.get("minUsableLauncherVersion").getAsInt();
View Full Code Here

     */
    @NonNull
    public void parseJSONtoMap (URL u, String name, HashMap<String, String> h, boolean testEntries, String location) {
        try {
            String json = IOUtils.toString(u);
            JsonElement element = new JsonParser().parse(json);
            int i = 10;
            if (element.isJsonObject()) {
                JsonObject jso = element.getAsJsonObject();
                for (Entry<String, JsonElement> e : jso.entrySet()) {
                    if (testEntries) {
View Full Code Here

    @SuppressWarnings("unchecked")
    private static Map<String, Object> decode (String s) {
        try {
            Map<String, Object> ret;
            JsonObject jso = new JsonParser().parse(s).getAsJsonObject();
            ret = (Map<String, Object>) decodeElement(jso);
            return ret;
        } catch (Exception e) {
            Logger.logError("Error decoding Authlib JSON", e);
            return null;
View Full Code Here

        }

        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

        }
        assertThat(handler.requestElement, is(nullValue()));
    }

    static JsonElement parse(String content) {
        return new JsonParser().parse(content);
    }
View Full Code Here

      if (input.getName() != null) {
         jsonTag.addProperty("name", input.getName());
      }

      if (input.getMeta() != null) {
         jsonTag.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
      }

      if (input.getResources() != null && input.getResources().size() != 0) {
         JsonArray uuidsArray = new JsonArray();
View Full Code Here

      if (input.getMemory() != null) {
         serverObject.addProperty("mem", input.getMemory().toString());
      }

      if (input.getMeta() != null) {
         serverObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
      }

      if (input.getRequirements() != null) {
         serverObject.add("requirements", new JsonParser().parse(new Gson().toJson(input.getRequirements())));
      }

      if (input.getTags() != null) {
         serverObject.add("tags", new JsonParser().parse(new Gson().toJson(input.getTags())));
      }

      if (input.getVncPassword() != null) {
         serverObject.addProperty("vnc_password", input.getVncPassword());
      }
View Full Code Here

      if (input.getLastName() != null) {
         profileJson.addProperty("last_name", input.getLastName());
      }

      if (input.getMeta() != null) {
         profileJson.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
      }

      if (input.getMyNotes() != null) {
         profileJson.addProperty("my_notes", input.getMyNotes());
      }
View Full Code Here

TOP

Related Classes of com.google.gson.JsonParser

Copyright © 2018 www.massapicom. 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.