Package org.unidal.webres.json

Examples of org.unidal.webres.json.JsonArray


    return builder.toString();
  }

  public String parseDomain(String content) throws Exception {
    JsonObject object = new JsonObject(content);
    JsonArray projectArray = object.getJSONArray("projects");

    if (projectArray.length() > 0) {
      JsonObject firstProject = projectArray.getJSONObject(0);
      return firstProject.get("project_name").toString();
    }
    return null;
  }
View Full Code Here


    return null;
  }

  public String parseHostname(String content) throws Exception {
    JsonObject object = new JsonObject(content);
    JsonArray resultArray = object.getJSONArray("result");

    if (resultArray.length() > 0) {
      JsonObject firstResult = resultArray.getJSONObject(0);
      return firstResult.get("hostname").toString();
    }
    return null;
  }
View Full Code Here

  public static void main(String args[]) throws Exception {
    String content = fetchContent(BU_API);

    JsonObject object = new JsonObject(content);
    JsonArray projectArray = object.getJSONArray("bu");
    int length = projectArray.length();

    for (int i = 0; i < length; i++) {
      JsonObject project = projectArray.getJSONObject(i);
      String bu = project.getString("bu_name");

      String nextUrl = String.format(PROJECT_API, bu, String.valueOf(1));
      String detailContent = fetchContent(nextUrl);
      print(bu, detailContent);
View Full Code Here

    }
  }

  private static void print(String bu, String detailContent) throws Exception {
    JsonObject object = new JsonObject(detailContent);
    JsonArray projectArray = object.getJSONArray("products");
    int length = projectArray.length();

    for (int i = 0; i < length; i++) {
      JsonObject project = projectArray.getJSONObject(i);
      String projectName = project.getString("product_name");

      System.out.println(bu + "\t" + projectName);
    }
  }
View Full Code Here

      return "Reload-CMDB-Ip-Domain-Info";
    }

    public String parseIp(String content) throws Exception {
      JsonObject object = new JsonObject(content);
      JsonArray array = object.getJSONArray("app");

      if (array.length() > 0) {
        return array.getString(0);
      }
      return null;
    }
View Full Code Here

TOP

Related Classes of org.unidal.webres.json.JsonArray

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.