[Interest] QML ListModels and JSON

Jason H jhihn at gmx.com
Wed Mar 25 20:58:33 CET 2015


I get back from a Ajax a JSON object with a 'table' from a web query:
[
{id: 1, "category":"1", value:"1"},
{id: 2, "category":"1", value:"2"},
{id: 3, "category":"2", value:"3"},
...
]

What is the easiest way to convert the array to ListElements? 
Up to this point, I was copying data using ListModel.append() but I was hoping there was an implicit conversion:

listModel = rows; // where rows = [... the array above... ]

I was also looking for a way to create a model of the distinct values of category. I realize there are sections within a ListView, but I want an actual model.


THanks.



More information about the Interest mailing list