Java Json Get getJsonObject(JsonObject object, String name)

Here you can find the source of getJsonObject(JsonObject object, String name)

Description

get Json Object

License

Open Source License

Declaration

public static JsonObject getJsonObject(JsonObject object, String name) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.json.JsonObject;

import javax.json.JsonValue;

public class Main {
    public static JsonObject getJsonObject(JsonObject object, String name) {
        if (hasKey(object, name)) {
            return object.getJsonObject(name);
        }//w  w  w  . ja v  a2  s  . c o m
        return null;
    }

    public static boolean hasKey(JsonObject object, String name) {
        JsonValue value = object.get(name);
        if ((value == null) || (value == JsonValue.NULL)) {
            return false;
        }
        return true;
    }
}

Related

  1. getIntegerArrayList(JsonArray array)
  2. getIntegerArrayListSansDoublons( JsonArray array)
  3. getJsonArray(JsonObject object, String name)
  4. getJsonIntArray(Iterable integers)
  5. getJsonNumberOrNull(JsonObject object, String key)
  6. getJsonValue(String json_path, JsonObject response)
  7. getKeyAsString(JsonObject obj, String key, String defaultValue)
  8. getLongProperty(JsonObject object, String property)
  9. getPrettyJsonWriterFactory()