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

Reply
Regular Contributor
Posts: 97
Registered: ‎04-19-2012
My Device: BB Torch-9800
My Carrier: *

How to pass data into Json Array format in Httpconenction?

Hi All,

 

Actually i want to pass json array data in my web service. below is the sample of data

[{"FollowupTypes":"Add to Mailing List;Provide Quote","Record[143.015] Id":"a0CF000000E2GOqMAN","leadRating":"3","Company":"Gl[143.015] obalnest","NextFollowUpdate":"2013-04-12 12:00:00","Designation":"CA","ScannedTime":"","Notes":"","E[143.015] mail":"alfanso@gmail.com","eventId":"a00F0000008DW4NIAW","UserId":"005F0000002OcqgIAC","BarcodeID":"[143.015] a0CF000000E2GOqMAN","Phone":"","state":"","LastName":"t[143.015] homas","FirstName":"Alfanso","City":"","SurveyAnswer1":"Not a Decision Maker","SurveyAnswer2":"","Su[143.015] rveyAnswer3":"Set Up Demo"}]

 How to do that, any body please tell me.

Developer
Posts: 188
Registered: ‎07-19-2012
My Device: Z10 LE
My Carrier: Three

Re: How to pass data into Json Array format in Httpconenction?

Exactly the same as you other thread, use JsonDataAccess. Only difference is that you're using the load() method this time, for which there is an example in the documentation. 

 

Because the example you posted there is an array, you'll want to convert the QVariant you get out into a QVariantList. This is easily done by using the toList() function on your QVariant.



Did this post help you? If so, please make sure to "like" it!
Regular Contributor
Posts: 97
Registered: ‎04-19-2012
My Device: BB Torch-9800
My Carrier: *

Re: How to pass data into Json Array format in Httpconenction?

Actually i dont want to parse that data, i want to set those array data into http connection body.

How ot create json array format data as per sample.

Developer
Posts: 188
Registered: ‎07-19-2012
My Device: Z10 LE
My Carrier: Three

Re: How to pass data into Json Array format in Httpconenction?

By the look of it, that's already valid JSON data. You should be fine to send that to your web service. Just make sure you set the header:

 

Content-Type: application/json

 So your server knows what to expect.



Did this post help you? If so, please make sure to "like" it!
Regular Contributor
Posts: 97
Registered: ‎04-19-2012
My Device: BB Torch-9800
My Carrier: *

Re: How to pass data into Json Array format in Httpconenction?

Thanks for reply, that one is sample, how ot make it json data same as sample.

 

Developer
Posts: 188
Registered: ‎07-19-2012
My Device: Z10 LE
My Carrier: Three

Re: How to pass data into Json Array format in Httpconenction?

What data type are you trying to convert from?



Did this post help you? If so, please make sure to "like" it!