Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
iod json parsing of nested objects
#include <iostream>
#include <iod/json.hh>
// Run iod_generate_symbols symbols.hh
#include "symbols.hh"
int main()
std::string str = R"({"name": "x", "position": { "x": 10, "y": 11, "z": 12}})";
using namespace s;
auto o = iod::D(_name = std::string(),
_position = iod::D(_x = int(), _y = int(), _z = int()));
json_decode(o, str);
assert( == "x");
assert(o.position.x == 10);
assert(o.position.y == 11);
assert(o.position.z == 12);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.