JSON parser gives empty Vector

26 views
Skip to first unread message

cr...@iversoft.ca

unread,
Nov 15, 2013, 12:01:40 PM11/15/13
to codenameone...@googlegroups.com
With the following JSON, which I confirmed is valid using an online tool and Chrome's developer tools, I get an empty Vector when I try to get the top level 'stats' entity. The 'metrics' key gives a 2-item vector, as expected. Any thoughts? I suspect there may be an issue with JSONParser. We are not having problems with this in other places in the application, which all use the same request/response code to retrieve data from the server.

{
   "stats":[
      {
         "id":1,
         "stats":[
            {
               "id":1,
               "value":"8",
               "metric":{
                  "id":1,
                  "name":"arm length",
                  "units":[

                  ]
               },
               "unit":{
                  "id":1,
                  "name":"in"
               }
            },
            {
               "id":2,
               "value":"200",
               "metric":{
                  "id":2,
                  "name":"height",
                  "units":[

                  ]
               },
               "unit":{
                  "id":2,
                  "name":"cm"
               }
            }
         ],
         "date":"2013-10-05T09:15:00+0000"
      }
   ],
   "metrics":[
      {
         "id":1,
         "name":"arm length",
         "units":[

         ]
      },
      {
         "id":2,
         "name":"height",
         "units":[

         ]
      }
   ]
}

Eric Coolman

unread,
Nov 15, 2013, 2:59:32 PM11/15/13
to codenameone...@googlegroups.com, cr...@iversoft.ca
Hi, tested it out and that json example parses fine for me.  Top level stats element has 1 element.

Eric
Reply all
Reply to author
Forward
0 new messages