Show HN: Go-style JSON Marshal / Unmarshal for C structs

by gyf304on 2/15/21, 6:22 AMwith 1 comments
by gyf304on 2/15/21, 6:23 AM

CMarshal brings Go style JSON marshaling / unmarshaling to C.

You can generate cJSON based JSON serializers and deserializers by adding a /* cmarshal:`true` */ comment to your C struct.

Potential use cases:

* Auto-generated JSON config parsers

* Simple struct printer (as a debugging mechanism, my goal in mind for this project)

* Introspecting C structs using cJSON API

* Easily bloat your program line count! (not the intended use case, of course)

Let me know how you think about this.*