Skip to content
/ json2cpp Public

python script that generates c++ mapping classes for a given json

License

Notifications You must be signed in to change notification settings

kcris/json2cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json2cpp

python script that generates c++ mapping classes for a given json

The typical c++ json parser library, loads json values into a map(string->variant), which discards all static checking that might be done by a compiler and that is error prone at runtime.

If a well known, fixed json format is used (taken from a json sample), direct mapping to c++ classes/members (preserving types) will allow typesafe client code.

About

  • generates c++ (11) classes with json load/save methods
  • each json object in our sample becomes a c++ class, each json property of such an object becomes a c++ class member
  • generated code still relies on a third party json parser library, currently cpprest
  • json arrays must be homogeneous (all elements must have same 'type')
  • the original script is available here (no subobjects supported)

About

python script that generates c++ mapping classes for a given json

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published