[ 
https://issues.apache.org/jira/browse/NIFI-12456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Stieglitz updated NIFI-12456:
------------------------------------
    Description: 
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.

  was:
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 do.

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.


> 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
>            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)

Reply via email to