private void encode(final String jsonInput) {
      if (jsonInput == null || jsonInput.isEmpty()) {
        throw new ParameterException(
            spec.commandLine(), "An error occurred while trying to read the JSON data.");
      } else {
        try {
          // encode and write the value
          writeOutput(type.getAdapter().encode(jsonInput));
        } catch (MismatchedInputException e) {
          throw new ParameterException(
              spec.commandLine(),
              "Unable to map the JSON data with selected type. Please check JSON input format. "
                  + e);
        } catch (IOException e) {
          throw new ParameterException(
              spec.commandLine(),
              "Unable to load the JSON data. Please check JSON input format. " + e);
        }
      }
    }
Encodes the JSON input into an RLP data based on the {@link #type} then goes to {@link
#writeOutput(Bytes)} this data to file or stdout

@param jsonInput the JSON string data to encode
app/src/main/java/org/hyperledger/besu/cli/subcommands/rlp/RLPSubCommand.java