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
New Developer
Posts: 5
Registered: ‎03-22-2014
My Device: Z10
My Carrier: SUN
Accepted Solution

QVariant to QString using saveToBuffer

Hi Everyone, I'm new in blackberry and qt development. I'm building an app that need to transmit a json in http but the problem is  during the convertion of QVariant to QString using saveToBuffer of JsonDataAccess class, The data from saveToBuffer was abruptly cut with a series of dots and a lot of records missing.

 

EXAMPLE : It suddenly stop at the "lastname" and  there is suppose a lot of records after the series of dots

"

[
{
"firstname":"blackberry"
"lastname":"Z10_00"
},
{
"firstname":"blackberry1"
"lastname":"Z10_01"
},
{
"firstname":"blackberry2"
"lastname":"Z10__02"
},
{
"firstname":"blackberry3"
"lastname":"..... "

 

-------------------------------------------------

There's anyone who encountered the same problem?

I hope somebody can help why saveToBuffer didn't return the complete json data . Thanks

Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: QVariant to QString using saveToBuffer

If you have a Json data in the local file then just use QFile to load them



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: QVariant to QString using saveToBuffer

... or better still one of the JSON classes available...

 

http://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/working_wi...


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: QVariant to QString using saveToBuffer


BBSJdev wrote:

... or better still one of the JSON classes available...

 

http://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/working_wi...


as I understood, he's already using JsonDataAccess

 

I never had a problem with JSON Files and JsonDataAccess - even 10' entries or more

 

at first I would check if the JSON data he got from server is correct

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: QVariant to QString using saveToBuffer

[ Edited ]

I think he want send JSON to server not parse received. So better is load directly with QFile. Using JsonDataAccess is in this case unnecessary.



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: QVariant to QString using saveToBuffer

Three different interpretations of the same OP, I read the OP as he was having trouble with the conversion not the sending therefore switching to one of the other JSON classes might have been an option.

Of course you are both right if that's what he meant. Smiley Happy

If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: QVariant to QString using saveToBuffer

;-)

 

perhaps some code would help

 

BTW: sometimes I'm using JsonDataAcces even to transmit data via Http,

because it's an easy way to convert a QVariantMap or QVariantList into JSON format

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: QVariant to QString using saveToBuffer

I forget. In this case it is useful



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
New Developer
Posts: 5
Registered: ‎03-22-2014
My Device: Z10
My Carrier: SUN

Re: QVariant to QString using saveToBuffer

Hi to all, the issue here was about the saveToBuffer from jsonDataAccess class..It doesnt store the qvariant data completely.. Thanks to all response.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: QVariant to QString using saveToBuffer

Could you post your code so we can verify?

If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.