Rafal Glowinski created GEODE-732:
-------------------------------------

             Summary: Unable to create PDXInstance from valid JSON using 
JSONFormatter
                 Key: GEODE-732
                 URL: https://issues.apache.org/jira/browse/GEODE-732
             Project: Geode
          Issue Type: Bug
            Reporter: Rafal Glowinski
         Attachments: json-parse-bug.json

JSONFormatter throws an exception (below) whenever I try to deserialize a valid 
JSON document, that has arrays inside an array, using JSONFormatter class.

Exception thrown:
{code}
Exception in thread "main" com.gemstone.gemfire.pdx.JSONFormatterException: 
Could not parse JSON document: [Source: [B@1cfd1875; line: 4, column: 8]
        at 
com.gemstone.gemfire.pdx.JSONFormatter.fromJSON(JSONFormatter.java:83)
        at GemfireClient.main(GemfireClient.java:28)
Caused by: java.lang.IllegalStateException: Object start called when state is 
LIST_FOUND
        at 
com.gemstone.gemfire.pdx.JSONFormatter.objectStarts(JSONFormatter.java:476)
        at 
com.gemstone.gemfire.pdx.JSONFormatter.getList(JSONFormatter.java:360)
        at 
com.gemstone.gemfire.pdx.JSONFormatter.getPdxInstance(JSONFormatter.java:180)
        at 
com.gemstone.gemfire.pdx.JSONFormatter.fromJSON(JSONFormatter.java:77)
        ... 1 more
{code}

Sample JSON causing problems:

{code:javascript}
{
  "photos": [
    [
      {
        "url": "image url",
        "dimensions": "192x144"
      },
      {
        "url": "image url",
        "dimensions": "original"
      },
      {
        "url": "image url",
        "dimensions": "128x96"
      },
      {
        "url": "image url",
        "dimensions": "64x48"
      },
      {
        "url": "image url",
        "dimensions": "400x300"
      }
    ],
    [
      {
        "url": "image url",
        "dimensions": "192x144"
      },
      {
        "url": "image url",
        "dimensions": "original"
      },
      {
        "url": "image url",
        "dimensions": "128x96"
      },
      {
        "url": "image url",
        "dimensions": "64x48"
      },
      {
        "url": "image url",
        "dimensions": "400x300"
      }
    ]
  ]
}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to