This is an example of how to use LayoutImportExport::exportLayout() and the resulting JSON it produces
#include "config-examples.h"
#include <scxmlimporter.h>
#include <state.h>
#include <layoutimportexport.h>
#include <QJsonDocument>
#include <QJsonObject>
#include <QFile>
#include <QScopedPointer>
#include <QTextStream>
int main()
{
QTextStream qErr(stderr);
QTextStream qOut(stdout);
const QString fileName = TEST_DATA_DIR "/scxml/example_trafficlight.scxml";
QFile file(fileName);
if (!file.exists()) {
qErr << "File does not exist:" << file.fileName();
return 1;
}
Q_ASSERT(file.open(QIODevice::ReadOnly));
QScopedPointer<StateMachine> machine(parser.import());
Q_ASSERT(machine);
qOut << "Layout in JSON format";
qOut << layout.toJson();
return 0;
}