{"id":27867614,"url":"https://github.com/eteran/qjson4","last_synced_at":"2025-05-04T22:50:44.709Z","repository":{"id":29111540,"uuid":"32641125","full_name":"eteran/qjson4","owner":"eteran","description":"A Qt4 library providing an API compatible with Qt5's JSON implementation","archived":false,"fork":false,"pushed_at":"2024-01-16T03:44:32.000Z","size":56,"stargazers_count":34,"open_issues_count":2,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-01T13:39:00.697Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eteran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-21T16:59:41.000Z","updated_at":"2024-04-02T10:43:32.000Z","dependencies_parsed_at":"2022-09-06T05:52:08.017Z","dependency_job_id":null,"html_url":"https://github.com/eteran/qjson4","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eteran%2Fqjson4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eteran%2Fqjson4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eteran%2Fqjson4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eteran%2Fqjson4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eteran","download_url":"https://codeload.github.com/eteran/qjson4/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252411808,"owners_count":21743604,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-04T22:50:43.753Z","updated_at":"2025-05-04T22:50:44.704Z","avatar_url":"https://github.com/eteran.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Qt5 introduced a very nice [API](http://doc.qt.io/qt-5/qjsondocument.html) for dealing with JSON. Unfortunately, it has not been back-ported to Qt4. This library is an attempt to implement the same API in Qt4.\n\nAdditionally, it is designed to be forward compatible, so if the library is built with Qt5, then you will get Qt's version of the API.\n\nSimply include the files in your project and `#include QJsonDocument.h` wherever you would `#include \u003cQJsonDocument\u003e` and it should be a drop-in replacement.\n\nNOTE: The library is not 100% complete yet, but is at a usable stage in development. I do plan to implement the library completely at some point. The following functions have not yet been implemented:\n\n* QJsonDocument::fromRawData\n* QJsonDocument::fromBinaryData\n* QJsonDocument::rawData\n* QJsonDocument::toBinaryData\n\nFinally, the following flags are not yet respected:\n\n* QJsonDocument::BypassValidation\n\nHere's an example of using the library:\n\n\t/*\n\tCopyright (C) 2014 - 2016 Evan Teran\n                        \t  evan.teran@gmail.com\n\n\tThis program is free software: you can redistribute it and/or modify\n\tit under the terms of the GNU General Public License as published by\n\tthe Free Software Foundation, either version 2 of the License, or\n\t(at your option) any later version.\n\n\tThis program is distributed in the hope that it will be useful,\n\tbut WITHOUT ANY WARRANTY; without even the implied warranty of\n\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\tGNU General Public License for more details.\n\n\tYou should have received a copy of the GNU General Public License\n\talong with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n\t*/\n\n\t#include \"QJsonValue.h\"\n\t#include \"QJsonDocument.h\"\n\t#include \"QJsonArray.h\"\n\t#include \"QJsonObject.h\"\n\t#include \"QJsonParseError.h\"\n\t#include \u003cQFile\u003e\n\t#include \u003cQCoreApplication\u003e\n\t#include \u003cQTextCodec\u003e\n\t#include \u003cQtDebug\u003e\n\n\tint main(int argc, char *argv[]) {\n\n\t\tQCoreApplication app(argc, argv);\n\n\t\tQFile f(\"test.json\");\n\t\tif(f.open(QIODevice::ReadOnly)) {\n\t\t\tQJsonParseError e;\n\t\t\tQJsonDocument d = QJsonDocument::fromJson(f.readAll(), \u0026e);\n\t\t\tif(!d.isNull() \u0026\u0026 e.error == QJsonParseError::NoError) {\n\t\t\t\tqDebug() \u003c\u003c QString::fromUtf8(d.toJson(QJsonDocument::Compact));\n\t\t\t} else {\n\t\t\t\tqDebug() \u003c\u003c e.errorString();\n\t\t\t}\n\t\t}\n\t}\n\nIf you are not using Qt, but still want a high quality c++ JSON implementation, then you can also check out my other JSON project [cpp-json](https://github.com/eteran/cpp-json).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feteran%2Fqjson4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feteran%2Fqjson4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feteran%2Fqjson4/lists"}