Skip to content

Json serialization poc#6

Draft
cameron-devine wants to merge 2 commits intodevfrom
json-serialization-poc
Draft

Json serialization poc#6
cameron-devine wants to merge 2 commits intodevfrom
json-serialization-poc

Conversation

@cameron-devine
Copy link
Copy Markdown
Collaborator

PR: Upgrade to C++23, Replace oatpp with cpp-httplib, Add Glaze JSON Serialization

Summary

Upgrades tsflib from C++17/20 to C++23 to support the Glaze high-performance JSON serialization library. As part of this modernization effort, the heavyweight oatpp HTTP framework (which has ceased active development) has been replaced with the lightweight, header-only cpp-httplib.

Motivation

  • oatpp is unmaintained — the project has stopped receiving updates on GitHub, making it a liability as a dependency.
  • Glaze offers compile-time, reflection-based JSON serialization that is significantly faster than nlohmann and works reliably across compiled library boundaries (unlike cereal, which suffered from static registration issues when linking across .a units).
  • C++23 is required by Glaze and positions the codebase for a future C++26 upgrade, which will enable even cleaner reflection-based serialization without explicit metadata templates.

Changes

Dependency changes:

  • ❌ Removed oatpp (HTTP framework + HTTP client)
  • ✅ Added cpp-httplib — lightweight, header-only HTTP client (pulled from Conan)
  • ✅ Added glaze 7.2.0 — compile-time JSON serialization (pulled from Conan)

HTTP client migration:

  • Replaced all oatpp API client calls (InfluxDB adapter, etc.) with httplib::Client
  • Removed unused oatpp DTO files and request/response wrappers
  • Enabled automatic path encoding via httplib::Client::set_path_encode(true) for proper URL handling of special characters

Glaze integration:

  • Added glz::meta template specialization for TSF::Clock using glz::custom accessors for getter/setter-based properties (name, period, offset)
  • Updated SqliteStore CRUD methods and RtxJsonUtilities archive/unarchive to use Glaze serialization for Clock objects
  • Updated unit tests to validate round-trip serialization via glz::write_json / glz::read_json

Build configuration:

  • Set CXX_STANDARD 23 in CMakeLists.txt
  • Updated conanfile.py with new dependencies

Future Work

  • C++26: Once AppleClang supports C++26, the explicit glz::meta template specializations can be eliminated entirely in favor of inline compile-time reflection, removing boilerplate from data classes like Clock.
  • nlohmann_json removal: Glaze could fully replace nlohmann throughout the project. Currently nlohmann is still used in areas like InfluxDB response parsing and the REST service layer — these can be migrated incrementally.
  • Expand Glaze to additional data classes: The pattern established with Clock can be applied to other tsflib types (TimeSeries, Units, Curve, etc.) for consistent cross-library serialization.

Testing

  • All clock serialization tests updated and passing
  • Round-trip (serialize → deserialize) validation for default values, custom values, and edge cases
  • InfluxDB adapter HTTP calls verified with cpp-httplib

Cameron Devine added 2 commits April 10, 2026 12:20
…++23 for glaze. Update InfluxTcpAdapter to use httplib instead of oatpp with the update to 23. Remove oatpp and curl dependencies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant