code: private static String validString(Object data) throws IOException {
          // Null is ok
          if (data == null) {
              return "";
          }
          if (!(data instanceof String)) {
              throw new IOException("Invalid non-String value found!");
          }
          return (String) data;
      }
docs: Ensures one of the generic objects coming from the JSON library
  is in fact a String.
  
  @param data The generic object
  @return String The String instance of the object
  @throws IOException if the object is not a String