Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.HashMap; public class Main { public static String asString(Object node, String key) { return asString(node, key, ""); } public static String asString(Object node, String key, String def) { Object value; if ((node instanceof HashMap<?, ?>) && ((value = ((HashMap<?, ?>) node).get(key)) != null)) { return String.valueOf(value); } else { return def; } } }