billyquith / ponder

C++ reflection library with Lua binding, and JSON and XML serialisation.
http://billyquith.github.io/ponder/
Other
640 stars 93 forks source link

Serializing Ponder Objects (XML / JSON) #43

Closed iwbnwif closed 3 years ago

iwbnwif commented 8 years ago

Hi, thank you for your continued efforts on this project.

There is a subfolder include/ponder-xml but as far as I can tell these features are not included in the documentation.

Actually, the methods serializeand deserialize (with the RapidXML compatibility layer) appear to do exactly what I need, but it would be even better if there was a RapidJSON alternative!

Do you think it would be possible to:

  1. Include the serialization methods in the documentation.
  2. Provide a small round-trip example.
  3. Consider an enhancement to also provide a [Rapid]JSON compatibility layer.
billyquith commented 8 years ago

This is related to issue #35. I think adding a JSON alternative is a good idea. I also want to drop support for so many (and many old) XML libraries.

Pretty busy at the moment but this functionality will be useful to me soon.

billyquith commented 7 years ago

I looked at some JSON libraries. https://github.com/miloyip/nativejson-benchmark

https://github.com/nlohmann/json is header only and ideally I'd use this but it fails on some compilers with spotty C++11 support, like GCC <4.9. Shame.

RapidJSON attractive. Code size is a little large.

PicoJSON does seem to be a good compromise although haven't tested it thoroughly.

Ideally I'd include a header only JSON library internally and have user callbacks for any data validation. JSON and XML could be two default storage formats using the same factories and traversal.

iwbnwif commented 7 years ago

RapidJSON attractive. Code size is a little large PicoJSON does seem to be a good compromise although haven't tested it thoroughly

Another one that you may care to look at is cJSON here. I only came across it because it was mentioned by the author of CodeLite that they are using it. Positives are ANSI C (so shouldn't be too many compiler issues), MIT and actively maintained.

billyquith commented 6 years ago
billyquith commented 6 years ago

Lightweight, fast JSON libs:

billyquith commented 6 years ago

I think we'll stick with RapidJSON for JSON usage since it is really fast, doesn't allocate, is conformant, etc.