Welcome!

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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 120
Registered: ‎12-22-2011
My Device: ---
My Carrier: ---

JSON Parsing in BB10

Dears,

 

I want to know how to parse json in BlackBerry 10 .

 

Thanks.

Retired
Posts: 16
Registered: ‎04-04-2013
My Device: Z10
My Carrier: Vivo

Re: JSON Parsing in BB10

If you are using Cascades, you can check this documentation: https://developer.blackberry.com/cascades/documentation/device_platform/data_access/working_with_jso...

 

Best regards,

Rodrigo Peixoto

Developer
Posts: 120
Registered: ‎12-22-2011
My Device: ---
My Carrier: ---

Re: JSON Parsing in BB10

i have QByteArray  that contain the json data 

how can i parse it 

the page you posted not clear for me .

Retired
Posts: 16
Registered: ‎04-04-2013
My Device: Z10
My Carrier: Vivo

Re: JSON Parsing in BB10

Try this one: https://developer.blackberry.com/cascades/files/release/samples/platform/jsonreadwrite.zip

This is a sample that shows how to do this.

Best regards,
Rodrigo Peixoto
Developer
Posts: 120
Registered: ‎12-22-2011
My Device: ---
My Carrier: ---

Re: JSON Parsing in BB10

i traced this code before but i found it return String fom the json 

i need to get Vector or map from the json to use it in another place .

 

 

Retired
Posts: 16
Registered: ‎04-04-2013
My Device: Z10
My Carrier: Vivo

Re: JSON Parsing in BB10

This method (https://developer.blackberry.com/cascades/reference/bb__data__jsondataaccess.html#function-loadfromb... will return a QVariant that contains a map.

Best regards,
Rodrigo Peixoto
Developer
Posts: 120
Registered: ‎12-22-2011
My Device: ---
My Carrier: ---

Re: JSON Parsing in BB10

thanks for your help 

 

now i parsed this json array 

("[{\"msg\":\"teto_1\"},{\"msg\":\"teto_2\"}]")

 

using 

QVariantList list = jda.loadFromBuffer(mJsonData).value<QVariantList>();

 but what can i do i have only jsonobject like :

("{\"msg\":\"teto_1\"}")

 how can i parse it ??

Developer
Posts: 120
Registered: ‎12-22-2011
My Device: ---
My Carrier: ---

Re: JSON Parsing in BB10

[ Edited ]

finally i did it 

 

using 

QVariant mainList = jda.loadFromBuffer(mJsonData);
qDebug() << mainList.toMap().value("msg");

 

really thank you