QJson project page QJson home page

Public Member Functions | List of all members
QJson::Serializer Class Reference

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)
 

Detailed Description

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.

Member Function Documentation

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.

Parameters
variantThe JSON document in its in-memory representation as generated by the parser.
outInput output device
okif 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.

Parameters
variantThe JSON document in its in-memory representation as generated by the parser.

Definition at line 92 of file serializer.cpp.

References serialize().


The documentation for this class was generated from the following files:

SourceForge Logo hosts this site. Send comments to:
QJson Developers