{"id":22767456,"url":"https://github.com/thomastrapp/recursive-variant","last_synced_at":"2026-04-18T12:03:42.674Z","repository":{"id":148175248,"uuid":"101339489","full_name":"thomastrapp/recursive-variant","owner":"thomastrapp","description":"A serializable recursive variant for JSON-like data","archived":false,"fork":false,"pushed_at":"2017-08-25T11:13:17.000Z","size":7,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T07:46:39.043Z","etag":null,"topics":["cereal","cpp","json","recursive","serialization","variant"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomastrapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-24T21:35:14.000Z","updated_at":"2021-03-20T12:06:54.000Z","dependencies_parsed_at":"2023-05-19T09:00:12.494Z","dependency_job_id":null,"html_url":"https://github.com/thomastrapp/recursive-variant","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thomastrapp/recursive-variant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomastrapp%2Frecursive-variant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomastrapp%2Frecursive-variant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomastrapp%2Frecursive-variant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomastrapp%2Frecursive-variant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomastrapp","download_url":"https://codeload.github.com/thomastrapp/recursive-variant/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomastrapp%2Frecursive-variant/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31967993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cereal","cpp","json","recursive","serialization","variant"],"created_at":"2024-12-11T13:30:57.973Z","updated_at":"2026-04-18T12:03:42.659Z","avatar_url":"https://github.com/thomastrapp.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serializable Boost Recursive Variant\n\nA Boost.Variant for JSON-like data with serialization support\nfor [cereal](http://uscilab.github.io/cereal/).\n\nThis project is released under the terms of the MIT license.\n\n## Dependencies\n\n* Boost.Variant, Boost.MPL\n* [cereal](http://uscilab.github.io/cereal/)\n* Testing: cmake, [catch](https://github.com/philsquared/Catch)\n\n## Types\n\n| Alias           | Type                                            |\n|-----------------|-------------------------------------------------|\n| `Value::Value`  | `Int\\|String\\|Vector\\|Map`                      |\n| `Value::Int`    | `int32_t`                                       |\n| `Value::String` | `std::string`                                   |\n| `Value::Vector` | `std::vector\u003cValue::Value\u003e`                     |\n| `Value::Map`    | `std::unordered_map\u003cstd::string, Value::Value\u003e` |\n\n## The gist\n\n```cpp\nusing Int = std::int32_t;\nusing String = std::string;\nusing Value = boost::make_recursive_variant\u003c\n    Int\n  , String\n  , std::vector\u003cboost::recursive_variant_\u003e\n  , std::unordered_map\u003cString, boost::recursive_variant_\u003e\n\u003e::type;\nusing Vector = boost::mpl::at\u003cValue::types, boost::mpl::int_\u003c2\u003e\u003e::type;\nusing Map = boost::mpl::at\u003cValue::types, boost::mpl::int_\u003c3\u003e\u003e::type;\n```\n\nDefined in [Value.h](include/Value/Value.h).\n\n## Helpers\n\n```cpp\ntemplate\u003ctypename Type\u003e\ninline bool Is(const Value\u0026 value) { return value.which() == TypeIndex\u003cType\u003e; }\n\ntemplate\u003ctypename Type\u003e\ninline Type\u0026 Get(Value\u0026 value) { return boost::get\u003cType\u003e(value); }\n\ntemplate\u003ctypename Type\u003e\ninline const Type\u0026 Get(const Value\u0026 value) { return boost::get\u003cType\u003e(value); }\n```\n\nDefined in [Helper.h](include/Value/Helper.h).\n\n## Serialization\n\nPowered by [cereal](http://uscilab.github.io/cereal/).\n\n```cpp\nValue::Map val({{\"beep\",\"boop\"}, {\"whoop\", Value::Vector({1,2,3,\"whoop\"})}});\nstd::string payload = Value::Pack(val);\n\nValue::Value unpacked = Value::Unpack(payload);\nassert(Value::Is\u003cValue::Map\u003e(unpacked));\n```\n\nDefined in [Serialization.h](include/Value/Serialization.h).\n\n## Switching by type\n\n```cpp\nnamespace V = Value;\nswitch( value.which() )\n{\ncase V::TypeIndex\u003cV::Int\u003e:    /* ... */ break;\ncase V::TypeIndex\u003cV::String\u003e: /* ... */ break;\ncase V::TypeIndex\u003cV::Vector\u003e: /* ... */ break;\ncase V::TypeIndex\u003cV::Map\u003e:    /* ... */ break;\ndefault: break;\n}\n```\n\nDefined in [TypeIndex.h](include/Value/TypeIndex.h).\n\n## Printing\n\n```cpp\nValue::Print(Value::Map({{\"beep\",\"boop\"}, {\"whoop\", Value::Vector({1,2,3,\"whoop\"})}}), std::cout);\n// {\"whoop\":[1, 2, 3, \"whoop\"], \"beep\":\"boop\"}\n```\n\nDefined in [Print.h](include/Value/Print.h).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomastrapp%2Frecursive-variant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomastrapp%2Frecursive-variant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomastrapp%2Frecursive-variant/lists"}