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
Developer
Posts: 86
Registered: ‎05-21-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: IDEA

How to load json data in qml?

Hi!

 

     I am trying to load json file data in qml. Can anyone give me sample on this....!

 

 

Thanks..!

 

- Raju
Developer
Posts: 262
Registered: ‎07-13-2012
My Device: PlayBook, DA B, DA C, LE Z10 #102, Q10, Z30
My Carrier: T-Mobile

Re: How to load json data in qml?

RIM has an example (stamp collector) with JSON data: https://github.com/blackberry/Cascades-Samples/tree/master/stampcollector

---
Check out my BB10 Cascades Coding site: BBcascades.com & Cascades Blog: bbcascadescode.tumblr.com

My Built for BlackBerry app: The Dive Plan
Developer
Posts: 86
Registered: ‎05-21-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: IDEA

Re: How to load json data in qml?

Is it not possible to load a json file through DataSource and populate a list view...?

- Raju
Developer
Posts: 230
Registered: ‎01-12-2013
My Device: z30
My Carrier: Mobile Vikings

Re: How to load json data in qml?

[ Edited ]

There is no JsonDataModel so I don't think it's possible. Maybe if you write it on your own. With XML it's possible to do so (XmlDataModel). So with custom coding I guess it's not impossible.

______________________________________________________
BB10-OAuth: GitHub
Developer
Developer
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha
My Carrier: -

Re: How to load json data in qml?

@raju_winit

yes it is possible to load json from datasource, take a look at the documentation:

https://developer.blackberry.com/cascades/reference/bb__data__datasource.html

 

DataSource {
 id: dataSource
 source: "testdata.json" //http://<server>/data.json
 onDataLoaded: {
  gDataModel.append(data);
 }
},
GroupDataModel {
 id: gDataModel
}
....

ListView {
 dataModel: gDataModel
}

 

 

 

Retired
Posts: 252
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10
My Carrier: Bell

Re: How to load json data in qml?

The sample application "RSS News" located here: https://developer.blackberry.com/cascades/sampleapps/ shows how to:

1- load data from a Json file into a DataSource

2- use a DataSource to fill a GroupDataModel

3- use a GroupDataModel to populate a ListView

 

Samar Abdelsayed - Application Development Consultant - BlackBerry


Did this answer your quetion? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker

@SamarAbdelsayed

Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker