If a schema is passed, the value is validated against that schema before
encoding. The schema may be passed as file path or as object returned
from JsonDecoder::decodeFile($schemaFile).
You can adjust the decoding with the various setters in this class.