hanhui03 / jstruct Goto Github PK
View Code? Open in Web Editor NEWjstruct is an automatic C code generation tool for generating JSON parsing and stringifying code.
License: Apache License 2.0
jstruct is an automatic C code generation tool for generating JSON parsing and stringifying code.
License: Apache License 2.0
When using the JStruct tool, there will be a scene of multi-layer structure nesting.
for example:
struct json_attitude { float roll; float yaw; float pitch; void *json; };
In the user's perspective, we don't know when to use void *json member in structure.In what scenarios do we need to use it?
For example, data like this:
{"foo":1203456,"bar":100,"boo":true, "str":"hello!","arr":[1.0,1.1,1.2,1.3],"han":3,1414999961853027}
The result after deserialization is as follows:
foo : 1
bar : 0
boo : 1
str : hello!
arr[0] : 1.000000
arr[1] : 1.100000
arr[2] : 1.200000
arr[3 ]: 1.300000
han : 3.141500
The result of using method yyjson_get_real() to parse int type data is incorrect, and using method yyjson_get_int() instead has the correct result.
cheng@cheng-virtual-machine:~/jstruct$ node jstruct.js conf.json
/home/cheng/jstruct/jstruct.js:72
for (var item of member) {
^^
SyntaxError: Unexpected identifier
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
At present, there is a very common data structure as follows:
typedef struct
{
union
{
unsigned short word;
struct
{
unsigned code1 :3;
unsigned code2 :5;
unsigned code3 :2;
unsigned code4 :6;
}block;
}order;
...
}
In order to be compatible with a large number of early module codes, this is a necessary data structure, and this data structure will be transmitted with high-level programming languages.
After careful study, the conclusion is that under the current use scenario, the union cannot be serialized in general, but can only be parsed in a targeted way. In consideration of the universality of Jstruct, it is recommended to negotiate the special data types that may be encountered at present and in the future.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.