Java Json Get getKeyAsString(JsonObject obj, String key, String defaultValue)

Here you can find the source of getKeyAsString(JsonObject obj, String key, String defaultValue)

Description

get Key As String

License

Open Source License

Declaration

public static String getKeyAsString(JsonObject obj, String key, String defaultValue) 

Method Source Code

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

import javax.json.JsonObject;

public class Main {
    public static String getKeyAsString(JsonObject obj, String key, String defaultValue) {
        String value = defaultValue;
        if (obj.containsKey(key)) {
            value = obj.get(key).toString();
        }//w w w . ja va  2s  . c o  m
        return value;
    }
}

Related

  1. getJsonArray(JsonObject object, String name)
  2. getJsonIntArray(Iterable integers)
  3. getJsonNumberOrNull(JsonObject object, String key)
  4. getJsonObject(JsonObject object, String name)
  5. getJsonValue(String json_path, JsonObject response)
  6. getLongProperty(JsonObject object, String property)
  7. getPrettyJsonWriterFactory()
  8. getSitesFromDb(String replicationSitesInDB)
  9. getString(JsonObject jso, String name)