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
Highlighted
Developer
Posts: 57
Registered: ‎08-14-2013
My Device: Z10 LE
My Carrier: Claro

Read and Write Json or Xml

Hi,

 

Can I read and write json or xml using only Javascript in Cascades? (I don't know about C++, I learn now)

 

or is better create my app using HTML5?

 

Thanks in advance

-----------------------------------------------------------------------------
My apps in the BlackBerry World
Twitter: @SoulVagrant
Trusted Contributor
Posts: 139
Registered: ‎08-22-2013
My Device: None
My Carrier: Aircel

Re: Read and Write Json or Xml

use blackberry web works sdk with javascript html code create blackberry app with native controls for more details click on below link for your reference:

 

https://developer.blackberry.com/html5/download/

 

best of luck for your developement buddy!

Developer
Posts: 57
Registered: ‎08-14-2013
My Device: Z10 LE
My Carrier: Claro

Re: Read and Write Json or Xml

Thanks, but is possible using Javascript in Cascades? Is for learn purposes too (I learn about Cascades).
-----------------------------------------------------------------------------
My apps in the BlackBerry World
Twitter: @SoulVagrant
Trusted Contributor
Posts: 139
Registered: ‎08-22-2013
My Device: None
My Carrier: Aircel

Re: Read and Write Json or Xml

if your wish need to develop app with native sdk to learn javascript in cascades or need to develop with webworks sdk following docs links for your reference

 

https://developer.blackberry.com/html5/documentation/creating_hello_world.html

 

but,you don't use javascript cascades in webworks sdk.

 

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

if my post help ful for your development like my post buddy thanks.........

Developer
Posts: 57
Registered: ‎08-14-2013
My Device: Z10 LE
My Carrier: Claro

Re: Read and Write Json or Xml

Yes, I want develop my app using Javascript in Qml files (Cascades), for learning purposes. (I know develop WebWorks apps, but I want learn about Cascades and limits using Javascript)

Sorry for my english, is basic
-----------------------------------------------------------------------------
My apps in the BlackBerry World
Twitter: @SoulVagrant
Trusted Contributor
Posts: 139
Registered: ‎08-22-2013
My Device: None
My Carrier: Aircel

Re: Read and Write Json or Xml

ok buddy see this below link for your startup with qml files with javascript cascades

 

https://developer.blackberry.com/native/documentation/cascades/ui/custom_components/custom_component...

Developer
Posts: 57
Registered: ‎08-14-2013
My Device: Z10 LE
My Carrier: Claro

Re: Read and Write Json or Xml

Great, thanks! I check now!
-----------------------------------------------------------------------------
My apps in the BlackBerry World
Twitter: @SoulVagrant
Trusted Contributor
Posts: 139
Registered: ‎08-22-2013
My Device: None
My Carrier: Aircel

Re: Read and Write Json or Xml

after check it if you know doubt's reply me i will try my level.....

 

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

if my post is useful click like buddy thanks.........

Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Read and Write Json or Xml

it's easier to do in C++ as you may think.

 

here's the code to read a JSON Array:

 

JsonDataAccess jda;
QVariantList rootArray;
QFile dataFile(...your path....);
bool ok = dataFile.open(QIODevice::ReadOnly);
if (ok) {
	rootArray = jda.loadFromBuffer(dataFile.readAll()).toList();
	dataFile.close();
} else {
	qDebug() << "cannot read data file: " << filename;
}

 If you have a JSON Object, use QVariantMap instead of QVariantList

 

in QML you can easy access: QVariantList maps to JS Array and QVariantMap maps to JS Object

 

remember: all of this gets compiled, all done in JS will be executed 'on top'

 

-------------------------------------------------------------------------------
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