{"id":21187605,"url":"https://github.com/pb82/elson","last_synced_at":"2025-07-10T02:31:10.051Z","repository":{"id":8200961,"uuid":"9632943","full_name":"pb82/Elson","owner":"pb82","description":"C++11 JSON Parser/Serializer","archived":false,"fork":false,"pushed_at":"2014-03-12T20:12:58.000Z","size":340,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-24T11:11:51.638Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/pb82.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}},"created_at":"2013-04-23T20:44:43.000Z","updated_at":"2015-08-25T20:59:41.000Z","dependencies_parsed_at":"2022-07-20T20:34:44.428Z","dependency_job_id":null,"html_url":"https://github.com/pb82/Elson","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pb82%2FElson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pb82%2FElson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pb82%2FElson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pb82%2FElson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pb82","download_url":"https://codeload.github.com/pb82/Elson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225611832,"owners_count":17496530,"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":[],"created_at":"2024-11-20T18:38:50.134Z","updated_at":"2024-11-20T18:38:50.788Z","avatar_url":"https://github.com/pb82.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Elson [![Build Status](https://travis-ci.org/pb82/Elson.png?branch=master)](https://travis-ci.org/pb82/Elson)\n=====\n\nA C++11 JSON Parser/Serializer that aims to make the usage of JSON in C++\nas natural and simple as possible. No dependencies (other than stl). Header only.\n\n\nTested with g++ 4.6, clang 3.1 (via Travis CI) and g++ 4.7.2\n\nLicense: MIT\n\nContributions welcome!\n\nWriting JSON\n-------------\n\n```c++\n#include \u003ciostream\u003e\n#include \"Elson.hpp\"\n\nint main() {\n    using namespace JSON;\n    Value val;\n    \n    val[\"Name\"] = \"Homer\";\n    val[\"Family\"][\"Wife\"] = \"Marge\";\n    val[\"Family\"][\"Kids\"] = { \"Bart\", \"Lisa\", \"Maggie\" };\n    val[\"Age\"] = 40;\n\n    PrettyPrinter printer;\n    std::cout \u003c\u003c printer.print(val) \u003c\u003c std::endl;\n\n    return 0;\n}\n```\n\nSince a JSON::Object is just a typedef'd std::map you may also use map's\ninitializer list constructor and write:\n\n```c++\n#include \u003ciostream\u003e\n#include \"Elson.hpp\"\n\nint main() {\n    using namespace JSON;\n    Value val = Object {\n        { \"Name\",   \"Homer\" },\n        { \"Family\", Object {\n            { \"Wife\", \"Marge\" },\n            { \"Kids\", { \"Bart\", \"Lisa\", \"Maggie\" } }\n          }\n        },\n        { \"Age\", 40 }\n    };\n    \n    PrettyPrinter printer;    \n    std::cout \u003c\u003c printer.print(val) \u003c\u003c std::endl;\n\n    return 0;\n}\n```\n\nAlmost JSON Literals. Nested Arrays may be written as:\n\n```c++\n\nValue val = { {1,0,0}, {0,1,0}, {0,0,1} };\n\n```\n\n\nReading JSON\n-------------\n\n```c++\n#include \u003ciostream\u003e\n#include \"Elson.hpp\"\n\nint main() {\n    using namespace JSON;\n    Value val;\n    Parser p;\n    \n    p.parse(val, \"{\\\"Answer\\\": \\\"42\\\"}\");\n    \n    double answer = val[\"Answer\"].as\u003cdouble\u003e();\n    \n    std::cout \u003c\u003c answer \u003c\u003c std::endl;\n\n    return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpb82%2Felson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpb82%2Felson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpb82%2Felson/lists"}