Hello!
I'm trying to parse JSON. Simple JSON message is no problem, but I don't know how can I parse arrays. My code:
JSON data:
Code:
newData = { "sucess":true, "msg":"Success!", "count":2, "data":[ { "id":"1", "title":"first", "type":"request", "created_at":"2010-12-20 09:00:00", "sender_id":"1", "sender_name":"someone" }, { "id":"2", "title":"second", "type":"notification", "created_at":"2010-12-21 09:00:00", "sender_id":"1", "sender_name":"someone" } ] }";
Parsing code:
Code:
qDebug() << newData << endl; QScriptValue sc; QScriptEngine engine; if (sc.property("sucess").toBool()) { qDebug() << sc.property("msg").toString() << endl; qDebug() << sc.property("count").toInteger() << endl; qDebug() << endl << sc.property("data").toString() << endl; }
Last line, when I want to parse 'data' array gives:
Code:
"[object Object],[object Object]"
How can I parse that piece of message? I don't want to use QJSON.
thanks in advance
best regards
Tomasz
