code: private String getText(JsonNode jsonObject, String nodeName) {
          JsonNode subNode = jsonObject.get(nodeName);
  
          if (subNode == null) {
              return null;
          }
  
          if (!subNode.isTextual()) {
              throw new IllegalStateException(nodeName + " from credential process should be textual, but was " +
                                              subNode.getNodeType());
          }
  
          return subNode.asText();
      }
docs: Get a textual value from a json object, throwing an exception if the node is missing or not textual.