{"id":15047805,"url":"https://github.com/sjmerel/simpson","last_synced_at":"2026-03-17T21:07:07.466Z","repository":{"id":100838653,"uuid":"410082598","full_name":"sjmerel/simpson","owner":"sjmerel","description":"A simple C++ JSON parser","archived":false,"fork":false,"pushed_at":"2023-03-25T16:43:24.000Z","size":137,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-01T08:56:53.526Z","etag":null,"topics":["cplusplus","cplusplus-11","json","json-api","json-parser"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sjmerel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2021-09-24T19:40:11.000Z","updated_at":"2021-10-01T15:59:47.000Z","dependencies_parsed_at":"2023-06-10T08:15:08.366Z","dependency_job_id":null,"html_url":"https://github.com/sjmerel/simpson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sjmerel/simpson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjmerel%2Fsimpson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjmerel%2Fsimpson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjmerel%2Fsimpson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjmerel%2Fsimpson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sjmerel","download_url":"https://codeload.github.com/sjmerel/simpson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjmerel%2Fsimpson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30631450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cplusplus","cplusplus-11","json","json-api","json-parser"],"created_at":"2024-09-24T21:04:52.600Z","updated_at":"2026-03-17T21:07:07.448Z","avatar_url":"https://github.com/sjmerel.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simpson\nA simple C++ JSON parser\n\nThis is a C++ API for reading, writing, and manipulating JSON data.\n\nDesign goals:\n1. Simple, easy to understand API\n1. Simple implementation (or at least, no more complex than it needs to be)\n1. Reasonable performance\n1. Portability\n1. Conformance to the JSON specification\n\nIt is written using standard C++ (at least the C++11 variant), so should compile on any platform that supports C++11.\n\n## Building\n\n1. Add the C++ files in simpson/src to your project.\n1. Add the top-level directory to your header search path\n1. In your code, include the header files like this:\n`#include \"simpson/jsonvalue.h\"`\n\nProject files are included for the test and example programs for Windows (Visual Studio 2019) and macOS (Xcode).\n\n## Usage\n\nCreate JSON data in code:\n\n```\nJsonValue value(JsonValue::Type::Object); // create an object\nvalue.set(\"a\", 3.2);\nvalue.set(\"b\", \"hello\");\n\n// value is now: { \"a\": 3.2, \"b\": \"hello\" }\n```\n\nWrite it to a file:\n```\nstd::ofstream stream(\"file.json\");\nvalue.write(stream);\n```\n\nWrite to stdout:\n```\nvalue.write(std::cout);\n```\n\nTo read a JSON file:\n```\nstd::ifstream stream(\"file.json\");\nvalue.read(stream);\n```\n\nParse a string:\n```\nstd::stringstream stream(\"{\\\"hello\\\": \\\"there\\\"}\");\nvalue.read(stream);\n```\n\nQuery values:\n```\ndouble a = value[\"a\"].number();\nstd::string b = value[\"b\"].string();\n```\n\nSee also [example/example.cpp](example/example.cpp).\n\n## Subscript operator vs. get()\n\nYou can access JSON object values with the get() function or the array subscript operator (i.e. operator[]). Note that the behavior is different; the get() function will throw an exception if the key is not found in the object, whereas the subscript operator will return a value of type Invalid.\n```\n// assume obj is { \"hello\": \"there\" }\nobj.get(\"goodbye\"); // this will throw an exception\nobj[\"goodbye\"]; // this will return an Invalid JsonValue\n```\n\nInvalid values do not correspond to any actual JSON types, but are a sort of dummy object. Querying an Invalid value for any key will return another Invalid value. This lets you do this kind of convenient chaining of subscript calls:\n```\nJsonValue value = obj[\"user\"][\"date_of_birth\"][\"year\"];\nif (value.isNumber())\n{\n   int year = value.numberInt();\n}\n```\nIf any of those keys don't exist, the value is invalid, and `isNumber()` will return false.\n\nOr, similarly:\n```\nint year = obj[\"user\"][\"date_of_birth\"][\"year\"].number(-1); // will return -1 if invalid\n```\n\nArray values behave similarly; if you access an out-of-range array element with the subscript operator, it will return an Invalid value.\n\n## License\n\nMIT license; see [LICENSE.txt](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjmerel%2Fsimpson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjmerel%2Fsimpson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjmerel%2Fsimpson/lists"}