You could move the QByteArray data = o.toJson();  out of the #ifdef.