Qt-interest Archive, December 2007
Qt4 and JSON
Message 1 in thread
Hi,
Has anyone written a JSON (http://www.json.org) parser for QT? Would be
nice to parse JSON text to a QObject. TIA.
From,
Carlos Yu
--
[ signature omitted ]
Message 2 in thread
There is a c++ based code available on JSON site which you can use in QT as well.
> From: developer@xxxxxxxxxxxxxxx
> Subject: Qt4 and JSON
> Date: Mon, 10 Dec 2007 08:01:57 +0800
> To: qt-interest@xxxxxxxxxxxxx
>
> Hi,
>
> Has anyone written a JSON (http://www.json.org) parser for QT? Would be
> nice to parse JSON text to a QObject. TIA.
>
> From,
> Carlos Yu
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
_________________________________________________________________
You keep typing, we keep giving. Download Messenger and join the i’m Initiative now.
http://im.live.com/messenger/im/home/?source=TAGLM
Message 3 in thread
Yes, saw a few for c and c++. Would you know which is the best for Qt
with minimal dependencies? Also, I tried an eval() call inside QtScript
to see if it could dynamically create an object from a hardcoded JSON
string. Looks like eval() is not supported in QtScript. Thanks.
Adnan Siddiqi wrote:
> There is a c++ based code available on JSON site which you can use in QT
> as well.
>
> > From: developer@xxxxxxxxxxxxxxx
> > Subject: Qt4 and JSON
> > Date: Mon, 10 Dec 2007 08:01:57 +0800
> > To: qt-interest@xxxxxxxxxxxxx
> >
> > Hi,
> >
> > Has anyone written a JSON (http://www.json.org) parser for QT? Would be
> > nice to parse JSON text to a QObject. TIA.
> >
> > From,
> > Carlos Yu
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
> >
>
> ------------------------------------------------------------------------
> You keep typing, we keep giving. Download Messenger and join the i’m
> Initiative now. Join in!
> <http://im.live.com/messenger/im/home/?source=CRM_WL_joinnow>
--
[ signature omitted ]
Message 4 in thread
Hi,
> Yes, saw a few for c and c++. Would you know which is the best for Qt
> with minimal dependencies? Also, I tried an eval() call inside QtScript
> to see if it could dynamically create an object from a hardcoded JSON
> string. Looks like eval() is not supported in QtScript. Thanks.
What's this eval() function? Would you expect Qt to provide such a function?
Do you mean QScriptEngine::evaluate()?
--
[ signature omitted ]
Message 5 in thread
eval () in native javascript will parse a JSON string and automatically
create a javascript object dynamically. check out http://json.org/js.html.
Dimitri wrote:
> Hi,
>
>> Yes, saw a few for c and c++. Would you know which is the best for Qt
>> with minimal dependencies? Also, I tried an eval() call inside
>> QtScript to see if it could dynamically create an object from a
>> hardcoded JSON string. Looks like eval() is not supported in
>> QtScript. Thanks.
>
> What's this eval() function? Would you expect Qt to provide such a
> function? Do you mean QScriptEngine::evaluate()?
>
> --
> Dimitri
--
[ signature omitted ]
Message 6 in thread
I thought about this myself, excluding QtScript it would be nice to
store/reload data as QVariants from Qt/C++.
JSON types would be mapped to QVariant types as follows:
object => QVariantMap
Array => QVariantList
value => QVariant::String QVariant::Int, QVariant::Double,
QVariant::Bool, and QVariant::Invalid for null
Now you have all the types necessary for a JSON parser in native
accessible types and you could store arbitrary data and parse it more
efficiently than XML.
--
[ signature omitted ]