Hi,
I am looking for QML json parser and display result on list on QML page
can you advice me with a good example
Thanks
Wael
Hi,
I am looking for QML json parser and display result on list on QML page
can you advice me with a good example
Thanks
Wael
Here is a JSON parser written in Javascript.
INclusion of the JS file and an example is below..
http://developer.qt.nokia.com/forums/viewthread/2057
Use Qt-Quick to make your application UI more attractive.
http://store.ovi.com/content/271896 | http://store.ovi.com/content/276199 | http://store.ovi.com/content/276202 | http://store.ovi.com/content/280827
Hello KKrish,
I guess you dont need to have dependencies with help of javascript eval method, json parsing is readily supported in the box.
so you can try something like:
var jsonObject = eval('(' + testToparse + ')');
which will return a list or a dict and than you can iterate over that to get what you want.
Let me know if you need a working example. :-)
Will it work on emulator?
getting error on on qtSDK 1.2 emulator "Result of expression 'jsonObject.flux' [undefined] is not an object"
Use Qt-Quick to make your application UI more attractive.
http://store.ovi.com/content/271896 | http://store.ovi.com/content/276199 | http://store.ovi.com/content/276202 | http://store.ovi.com/content/280827
anything need to import for it?
Use Qt-Quick to make your application UI more attractive.
http://store.ovi.com/content/271896 | http://store.ovi.com/content/276199 | http://store.ovi.com/content/276202 | http://store.ovi.com/content/280827
can you show the code you are trying its working good on my side and you dont need to import anything new.
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState === 4) {
if (xmlhttp.status === 200) {
var jsonObject = eval('(' + xmlhttp.responseText + ')');
for ( var index in jsonObject.flux.all )
{
console.log(jsonObject.flux.all[index].data["title"]);
console.log(jsonObject.flux.all[index].data["content"]);
}
} else {
console.log("responseText", xmlhttp.responseText);
}
}
}
Use Qt-Quick to make your application UI more attractive.
http://store.ovi.com/content/271896 | http://store.ovi.com/content/276199 | http://store.ovi.com/content/276202 | http://store.ovi.com/content/280827
it is done. just going through with the json document and how we can access the element from json object.
Use Qt-Quick to make your application UI more attractive.
http://store.ovi.com/content/271896 | http://store.ovi.com/content/276199 | http://store.ovi.com/content/276202 | http://store.ovi.com/content/280827
QML includes a "JSON" parser. Instead of using eval use JSON.parse.... No need to include or import anything...
Use Qt-Quick to make your application UI more attractive.
http://store.ovi.com/content/271896 | http://store.ovi.com/content/276199 | http://store.ovi.com/content/276202 | http://store.ovi.com/content/280827