Here you can find the source of getKeyAsString(JsonObject obj, String key, String defaultValue)
public static String getKeyAsString(JsonObject obj, String key, String defaultValue)
//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; } }