# json-editor-for-cpp **Repository Path**: tizzybec/json-editor-for-cpp ## Basic Information - **Project Name**: json-editor-for-cpp - **Description**: this project provide bid-convertor between cpp struct and json,and provide json schema that coordinate to cpp struct,thus we can construct a json editor with user interface(web/qt) - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-06-10 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # json-editor-for-cpp ## intoduction this project provide bid-convertor between cpp struct and json,and provide json schema that coordinate to cpp struct,thus we can construct a json editor with user interface(web/qt) ## features - none intrude c/c++ struct serialization support - arbitrary template for code generator - json and c/c++ bidi-convertion - easy complex container support by c++ template - json schema support for auto ui generator ## example ```C++ namespace Sample { struct SampleClass { int a; double b; }; } // generate code for Sample::SampleClass and compile with these code #include ... // constructor object void *obj = tb::serializer::CreateObject("Sample.SampleClass"); Sample::SampleClass *sc = (Sample::SampleClass *)obj; sc->a = 314; sc->b = 3.14; std::string jsonData; std::string err; bool ret = tb::serializer::Object2Json("Sample.SampleClass", obj, jsonData, err); assert(ret); void *newObj = NULL; ret = tb::serializer::Json2Object2("Sample.SampleClass", jsonData.c_str(), &newObj, err) assert(ret && newObj); // or void *newObj = (void *)new Sample::SampleClass(); ret = tb::serializer::Json2Object("Sample.SampleClass", jsonData.c_str(), newObj, err) assert(ret && newObj); Sample::SampleClass *newsc = (Sample::SampleClass *)newObj; assert(newsc->a == sc->a); assert(abs(newsc->b - sc->b) < 0.00001); ... ``` ## structure - cpp: bidi-conversion mechanism in c/c++ side - python: c/c++ code parser using clang(python binding) and code generator for schema and bidi-convertor - tmpl: templates for json schema and cpp implementation ## todo actually we implemete a ui generator based on json schema using Qt technology, thus we can use a Qt based json editor to generate json data for every c/c++ type and convert it to a c/c++ instance, and int other hand, we can edit all c/c++ instance using by convert it to a json instance and reveal it by Qt widget. in the future, we also want to implement a json editor using web technolygy. ## contact author: tizzybec email: tizzybec@outlook.com gitee: tizzybec