Package com.google.gson.stream

Examples of com.google.gson.stream.JsonReader.beginObject()


    JsonReader reader = prepareReader(simplePropertyJson);
    EdmProperty edmProperty =
        (EdmProperty) MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams").getEntityType()
            .getProperty("Name");
    EntityPropertyInfo entityPropertyInfo = EntityInfoAggregator.create(edmProperty);
    reader.beginObject();
    reader.nextName();

    JsonPropertyConsumer jpc = new JsonPropertyConsumer();
    Object value = jpc.readPropertyValue(reader, entityPropertyInfo, null, null);
    assertEquals("Team 1", value);
View Full Code Here


  @RequestMapping(method = RequestMethod.POST, consumes = "application/json")
  public String importData(Reader in, Model m) throws IOException {

    JsonReader reader = new JsonReader(in);

    reader.beginObject();

    while (reader.hasNext()) {
      JsonToken tok = reader.peek();
      switch (tok) {
        case NAME:
View Full Code Here

     * @return String The uid of the user that matches the login
     */
    public static String parseUid(String loginResponse) {
        try {
            JsonReader reader = new JsonReader(new StringReader(loginResponse));
            reader.beginObject();
            String name = reader.nextName();
            while (!name.equals("user")) {
                reader.nextString();
                name = reader.nextName();
            }
View Full Code Here

            String name = reader.nextName();
            while (!name.equals("user")) {
                reader.nextString();
                name = reader.nextName();
            }
            reader.beginObject();
            name = reader.nextName();
            String value = reader.nextString();
            reader.close();
            return value;
        } catch (IOException ex) {
View Full Code Here

    public static CookieSetting parseCookie(String loginResponse) {
        try {
            String session_id = "";
            String session_name = "";
            JsonReader reader = new JsonReader(new StringReader(loginResponse));
            reader.beginObject();
            String name = reader.nextName();
            if (name.equals("sessid")) {
                session_id = reader.nextString();
            }
            name = reader.nextName();
View Full Code Here

            try {
                jsonResponse = resp.getEntity().getText();
                System.out.println(jsonResponse);
                //extract the fid field
                JsonReader reader = new JsonReader(new StringReader(jsonResponse));
                reader.beginObject();
                String jsonName = reader.nextName();
                if (jsonName.equals("nid")) {
                    nid = reader.nextString();
                }
                reader.close();
View Full Code Here

    //Very quick parse, should be done better
    public void parseJson(String json) {
        try {
            JsonReader reader = new JsonReader(new StringReader(json));
            reader.beginObject();
            while (reader.hasNext()) {
                String name = reader.nextName();
                if (name.equals("title")) {
                    title = reader.nextString();
                } else if (name.equals("path")) {
View Full Code Here

                    title = reader.nextString();
                } else if (name.equals("path")) {
                    path = reader.nextString();
                } else if (name.equals("field_file")) {
                    reader.beginArray();
                    reader.beginObject();
                    while (reader.hasNext()) {
                        String name2 = reader.nextName();
                        if (name2.equals("filename")) {
                            filename = reader.nextString();
                        } else if (name2.equals("filepath")) {
View Full Code Here

            }

            String session_id = "";
            String session_name = "";
            JsonReader reader = new JsonReader(new StringReader(jsonResponse));
            reader.beginObject();
            String name = reader.nextName();
            if (name.equals("sessid")) {
                session_id = reader.nextString();
            }
            name = reader.nextName();
View Full Code Here

        loadRules();
    }
   
    private void loadRules() {
        try (JsonReader reader = new JsonReader(new FileReader(file))) {
            reader.beginObject();
            while (reader.hasNext()) {
                String name = reader.nextName();
                if (name.equals("rules")) {
                    rules = readRules(reader);
                }else{
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.