You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "paul nikonowicz (Jira)" <ji...@apache.org> on 2021/02/09 17:19:00 UTC

[jira] [Commented] (GEODE-8254) JSONFormatter cannot parse JSON Arrays

    [ https://issues.apache.org/jira/browse/GEODE-8254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17281902#comment-17281902 ] 

paul nikonowicz commented on GEODE-8254:
----------------------------------------

# Is it expected that in order to support JSON Arrays, [fromJSON|https://github.com/apache/geode/blob/af5a044175ee9cee55bf46f4af8be15faafa0687/geode-core/src/main/java/org/apache/geode/pdx/JSONFormatter.java#L133] should wrap the PdxData into a collection type? If so, what is the preferred collection type? It would need to be something can be serialized into the cache (i think?). Would ArrayList work or is there something more appropriate? 
 # If we wrap PdxData into a collection type (see 1), would we expect the JSON serialization output to match the input (ie: a(b) = b(a)) 
 # All `@types` fields in the array must be the same (because we use java and the concept of a [Union|https://en.cppreference.com/w/cpp/language/union] is not supported). Should validation be performed and exceptions thrown if not all type fields are the same, or could assumptions (a heuristic) be made to assume what all types in the array should be (for instance, just read the first type and apply that type to all elements in the array)?

 

 

> JSONFormatter cannot parse JSON Arrays
> --------------------------------------
>
>                 Key: GEODE-8254
>                 URL: https://issues.apache.org/jira/browse/GEODE-8254
>             Project: Geode
>          Issue Type: Bug
>          Components: serialization
>    Affects Versions: 1.9.2, 1.10.0, 1.11.0, 1.12.0
>            Reporter: John Blum
>            Priority: Major
>              Labels: JSON-PDX
>
> The Apache Geode [JSONFormatter|https://geode.apache.org/releases/latest/javadoc/org/apache/geode/pdx/JSONFormatter.html] class is not capable of parsing/processing JSON Arrays, making it less than adequate to process JSON documents and content.
> This leaves the responsibility and burden on the user, which requires the user to inspect the individual array elements.
> A test case reproducing this issue can be found [here|https://geode.apache.org/releases/latest/javadoc/org/apache/geode/pdx/JSONFormatter.html]. The matching JSON document is [here|https://github.com/spring-projects/spring-boot-data-geode/blob/1.3.0.RELEASE/spring-geode/src/test/resources/data-example-doefamily.json].
> JSON Arrays are a very common JSON data type, as [specified|https://www.json.org/json-en.html].



--
This message was sent by Atlassian Jira
(v8.3.4#803005)