QJson project page | QJson home page |
Main class used to convert QVariant objects to JSON data. More...
#include <serializer.h>
Public Member Functions | |
void | serialize (const QVariant &variant, QIODevice *out, bool *ok=0) |
QByteArray | serialize (const QVariant &variant) |
Main class used to convert QVariant objects to JSON data.
QVariant objects are converted to a string containing the JSON data. If QVariant object is empty or not valid a null json object is returned.
Definition at line 37 of file serializer.h.
void Serializer::serialize | ( | const QVariant & | variant, |
QIODevice * | out, | ||
bool * | ok = 0 |
||
) |
This method generates a textual JSON representation and outputs it to the passed in I/O Device.
variant | The JSON document in its in-memory representation as generated by the parser. |
out | Input output device |
ok | if a conversion error occurs, *ok is set to false; otherwise *ok is set to true |
Definition at line 40 of file serializer.cpp.
Referenced by serialize().
QByteArray Serializer::serialize | ( | const QVariant & | variant | ) |
This is a method provided for convenience. It turns the passed in in-memory representation of the JSON document into a textual one, which is returned. If the returned string is empty, the document was empty. If it was null, there was a parsing error.
variant | The JSON document in its in-memory representation as generated by the parser. |
Definition at line 92 of file serializer.cpp.
References serialize().
|
hosts this site. |
Send comments to: QJson Developers |