Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Trusted Contributor
Posts: 115
Registered: ‎02-08-2013
My Carrier: verizon
Accepted Solution

problem parsing json array

I have been trying to parse a json response after following examples and sample code on forum but there is no direct example to parse something like [{"uri":"file:///accounts/1000/shared/camera/IMG_00000012.jpg"}] and I can't figure it out, how can I enter into for loop and print every uri in the response?


Thanks for any help.

Please use plain text.
Posts: 206
Registered: ‎01-12-2013
My Carrier: Mobile Vikings

Re: problem parsing json array

[ Edited ]

What I do to parse the json is the following


JsonDataAccess jda;

QVariantList list = jda.load(reply).value<QVariantList>();

 Then you have a QVariantList and you can iterate over it. Hopes this was a little bit helpfull.



I have to say that the reply is a response of a networkrequest. You'll have to find a way of parsing a file with json to a QVariantList. I'll be guessing that google is your best friend for that. "QString to QVariantList" or "json to QVariantList". Something like that.

beRail: BlackBerry World - GitHub
Mobile Vikings: BlackBerry World - GitHub
Park in Brussels: BlackBerry World
Please use plain text.