[
https://issues.apache.org/jira/browse/NIFI-12456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18074976#comment-18074976
]
Mark Payne commented on NIFI-12456:
-----------------------------------
Thanks [~dstiegli1] as a general rule, I'd say we want to be lenient in what we
accept and strict in what we produce. So we should allow JSON to be read even
if it's not 100% correct according to the schema, if it's a common pattern. But
we should always produce valid JSON according to the schema. So I would not
enable things like turning off quoting of field names in the writer.
But in general I'd say it makes sense to allow leading plus signs, leading
zeros, and single-quoted or unquoted field names and trailing commas/decimal
points. I'd also lean toward allowing yaml and java comments, as well as
missing values.
> Improve leniency of JSON readers and flexibility of JSON Writer
> ---------------------------------------------------------------
>
> Key: NIFI-12456
> URL: https://issues.apache.org/jira/browse/NIFI-12456
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Extensions
> Reporter: Mark Payne
> Assignee: Daniel Stieglitz
> Priority: Major
>
> Currently, we adhere to the JSON specification fairly strictly, with the
> exception of allowing for "JSON Lines" / ndjson / ldjson.
> However, the Jackson library allows for several {{Features}} that we do not
> expose, which may be helpful for handling data that does not strictly adhere
> to the schema, or where there are preferences in serialization.
> For example, {{JsonParser.Feature}} allows for the ability to allow comments
> in JSON (to include lines beginning with {{{}//{}}}, {{{}/*{}}}, and "YAML
> Style" comments (#)). Additionally, it allows for single-quotes for field
> names or no quoting at all. While these do not adhere to the specification,
> they are common enough for the parser to support them, and we should too.
> Similarly, on the serialization side, we have had requests to support writing
> decimal values without use of scientific notation, which can be achieved by
> enabling the {{WRITE_BIGDECIMAL_AS_PLAIN}} feature.
> We should expose these options on the JsonTreeReader and the JSON Writer. I
> don't know of any downside to enabling the leniency / non-standard options,
> so it probably makes sense to simply enable them all by default. Though there
> is argument for introducing a new "Parsing Leniency" option that allows the
> user to disable these features.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)