Coerce a raw string value to the correct JSON type based on cast.
Parses a string to Bool?, returning nil for unrecognised tokens. Canonical truthy: "true", "1", "yes". Canonical falsy: "false", "0", "no".