Package com.google.gson

Examples of com.google.gson.JsonParser


      }

      JsonObject ipObject = new JsonObject();

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

      return ipObject;
   }
View Full Code Here


      }

      JsonObject vlanObject = new JsonObject();

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

      return vlanObject;
   }
View Full Code Here

      if (input.getMedia() != null) {
         driveObject.addProperty("media", input.getMedia().toString());
      }

      if (input.getAffinities() != null) {
         driveObject.add("affinities", new JsonParser().parse(new Gson().toJson(input.getAffinities())));
      }

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

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

      driveObject.addProperty("allow_multimount", input.isAllowMultimount());
      return driveObject;
   }
View Full Code Here

public final class JsonToResource {
  private JsonToResource() {
  }

  public static Resource parse(InputStream inputStream) {
    JsonElement element = new JsonParser().parse(new InputStreamReader(inputStream));
    return parseResource(element.getAsJsonObject(), "/", null);
  }
View Full Code Here

        expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);
   
    JsonParser parser = new JsonParser();
    assertEquals(parser.parse(expected.string()),parser.parse(actual.string()));
  }
View Full Code Here

        expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);

    JsonParser parser = new JsonParser();
    assertEquals(parser.parse(expected.string()),parser.parse(actual.string()));
  }
View Full Code Here

        } finally {
          br.close();
        }

        // Parse the credentials
        JsonParser parser = new JsonParser();
        JsonObject obj = (JsonObject) parser.parse(json.toString());

        // Create a client
        JumblrClient client = new JumblrClient(
            obj.getAsJsonPrimitive("consumer_key").getAsString(),
            obj.getAsJsonPrimitive("consumer_secret").getAsString()
View Full Code Here

          reporter.incrCounter(this._counterGroup, "Invalid Domain", 1);
          return;
        }

        // See if the page has a successful HTTP code
        JsonParser jsonParser = new JsonParser();
        JsonObject jsonObj    = jsonParser.parse(json).getAsJsonObject();

        int httpCode;

        if (jsonObj.has("http_result") == false) {
          reporter.incrCounter(this._counterGroup, "HTTP Code Missing", 1);
View Full Code Here

      String json  = value.toString();

      try {
        // See if the page has a successful HTTP code
        JsonParser jsonParser = new JsonParser();
        JsonObject jsonObj    = jsonParser.parse(json).getAsJsonObject();

        boolean isSuccessful = false;

        String disposition = "[no status]";
View Full Code Here

        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

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.