public static String asString(String jsonPath,Map<String,Object> json){
  String str=null;
  Object obj=atPath(jsonPath,json);
  if (obj != null) {
    if (obj instanceof String) {
      str=(String)obj;
    }
 else {
      throw new IllegalStateException("Expected a String at path " + jsonPath + " but found "+ obj+ " instead! "+ json);
    }
  }
  return str;
}

public static String asString ( String jsonPath , Map < String , Object > json ) { String str = null ; Object obj = atPath ( jsonPath , json ) ; if ( obj != null ) { if ( obj instanceof String ) { str = ( String ) obj ; } else { throw new IllegalStateException ( "Expected a String at path " + jsonPath + " but found " + obj + " instead! " + json ) ; } } return str ; }
helper function for reading a string value from a json object tree .
