{"id":24755329,"url":"https://github.com/cppfw/jsondom","last_synced_at":"2025-07-12T01:38:58.833Z","repository":{"id":72280134,"uuid":"272536298","full_name":"cppfw/jsondom","owner":"cppfw","description":"C++ library for JSON parsing and DOM","archived":false,"fork":false,"pushed_at":"2024-11-19T21:11:47.000Z","size":355,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-21T03:28:21.643Z","etag":null,"topics":["cpp","dom","json"],"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/cppfw.png","metadata":{"files":{"readme":"README.adoc","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":"2020-06-15T20:23:08.000Z","updated_at":"2024-11-19T21:11:48.000Z","dependencies_parsed_at":"2024-05-28T22:29:06.073Z","dependency_job_id":"8d8620b5-97d3-4703-9d4d-997f78709ce5","html_url":"https://github.com/cppfw/jsondom","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppfw%2Fjsondom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppfw%2Fjsondom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppfw%2Fjsondom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppfw%2Fjsondom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cppfw","download_url":"https://codeload.github.com/cppfw/jsondom/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236018740,"owners_count":19082133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cpp","dom","json"],"created_at":"2025-01-28T12:38:47.383Z","updated_at":"2025-07-12T01:38:58.820Z","avatar_url":"https://github.com/cppfw.png","language":"C++","readme":":name: jsondom\n\n= {name}\n\n|====\n| link:https://github.com/cppfw/{name}/releases[image:https://img.shields.io/github/tag/cppfw/{name}.svg[releases]] | link:https://github.com/cppfw/{name}/actions[image:https://github.com/cppfw/{name}/workflows/ci/badge.svg[ci status]] | link:https://codecov.io/gh/cppfw/{name}[image:https://codecov.io/gh/cppfw/{name}/branch/main/graph/badge.svg?token=vwqhr1CujV[codecov.io]]\n|====\n\nJSON parser and DOM library in C++.\n\n== Istallation\n:package_name: {name}\n\n. Setup your OS-preferred package system repo following link:https://github.com/cppfw/wiki/blob/main/EnableRepo.adoc[this manual]\n. Install package\n+\n- **vcpkg** (multi-OS): `{package_name}`\n- **conan** (multi-OS): `{package_name}`\n- **deb** (Linux): `lib{package_name}`\n- **homebrew** (MacOS X): `lib{package_name}`\n- **pacman** (Windows, Msys2): `mingw-w64-i686-{package_name}`, `mingw-w64-x86_64-{package_name}`\n- **Nuget** (DEPRECATED!!! use `vcpkg`) (Windows, Visual Studio): `lib{package_name}`\n- **cocoapods** (iOS, xcode): `{package_name}`\n- **gradle** (Android): `{package_name}`\n\n== Tutorial\n\n[source,cpp]\n....\n#include \u003ciostream\u003e\n#include \u003ccassert\u003e\n\n#include \u003cjsondom/dom.hpp\u003e\n\nconst char* json = R\"qwertyuiop(\n\t{\n\t\t\"key1\": \"value1\",\n\t\t\"key2\": \"value2\"\n\t}\n)qwertyuiop\";\n\nint main(int c, const char** v){\n\t// parse the JSON to DOM\n\tauto dom = jsondom::read(json);\n\n\t// check that root node is a JSON object, just to be sure\n\tassert(dom.is_object());\n\n\t// let's check if there is an expected key1-value1 pair,\n\t// but do not fail if there is no such key or value is not of an expected type\n\n\tauto value1_i = dom.object().find(\"key1\");\n\tif(value1_i != dom.object().end()){\n\t\tauto\u0026 value1 = value1_i-\u003esecond;\n\t\tif(value1.is_string()){\n\t\t\tstd::cout \u003c\u003c \"value1 = \" \u003c\u003c value1.string() \u003c\u003c std::endl;\n\t\t}else{\n\t\t\t// this never happens in this example, but just to show how\n\t\t\t// to handle cases when JSON value type is not as expected\n\t\t\tstd::cout \u003c\u003c \"value1 is not a string\" \u003c\u003c std::endl;\n\t\t}\n\t}else{\n\t\t// this never happens in this example, but just to show how\n\t\t// to handle cases when JSON key is not found\n\t\tstd::cout \u003c\u003c \"key1 is not found\" \u003c\u003c std::endl;\n\t}\n\n\t// Try to use key2-value2 pair, relying on that it exists.\n\t// An exception will be thrown if something goes wrong, like\n\t// no 'key2' key is found or value is of unexpected type.\n\n\ttry{\n\t\tstd::cout \u003c\u003c \"value2 = \" \u003c\u003c dom.object().at(\"key2\").string() \u003c\u003c std::endl;\n\t}catch(std::logic_error\u0026 e){\n\t\t// handle exception here if needed\n\t\tstd::cout \u003c\u003c e.what() \u003c\u003c std::endl;\n\t\tthrow;\n\t}\n\n\treturn 0;\n}\n....\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcppfw%2Fjsondom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcppfw%2Fjsondom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcppfw%2Fjsondom/lists"}