code: protected static String getString(JSONObject json, String key) {
  
          JSONValue value = json.get(key);
          JSONString str = value.isString();
          if (str == null) {
              return null;
          }
          return str.stringValue();
      }
docs: Helper method to get a string value from a JSON object.<p>
  
  @param json the JSON object
  @param key the key whose value should be extracted as a string
  
  @return the string value for the given key