{"id":26063279,"url":"https://github.com/edgio/json_parser","last_synced_at":"2025-04-11T11:50:23.671Z","repository":{"id":33186454,"uuid":"36828318","full_name":"Edgio/json_parser","owner":"Edgio","description":"Simple lightweight header-only JSON Parser from Edgio","archived":false,"fork":false,"pushed_at":"2022-06-23T03:12:09.000Z","size":72,"stargazers_count":9,"open_issues_count":0,"forks_count":6,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-03-25T08:11:10.767Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Edgio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-2.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-03T20:20:52.000Z","updated_at":"2023-12-05T00:15:47.000Z","dependencies_parsed_at":"2022-09-12T19:11:09.534Z","dependency_job_id":null,"html_url":"https://github.com/Edgio/json_parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edgio%2Fjson_parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edgio%2Fjson_parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edgio%2Fjson_parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edgio%2Fjson_parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Edgio","download_url":"https://codeload.github.com/Edgio/json_parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248389740,"owners_count":21095643,"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":"2025-03-08T16:34:29.212Z","updated_at":"2025-04-11T11:50:23.646Z","avatar_url":"https://github.com/Edgio.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!------------------------------------------------------------------------------\n# Copyright (C) 2015 Verizon.  All Rights Reserved.\n# All Rights Reserved\n#\n#   Author: Donnevan \"Scott\" yeager\n#   Date:   02/03/2015\n#\n#   Licensed under the Apache License, Version 2.0 (the \"License\");\n#   you may not use this file except in compliance with the License.\n#   You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n#   Unless required by applicable law or agreed to in writing, software\n#   distributed under the License is distributed on an \"AS IS\" BASIS,\n#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n#   See the License for the specific language governing permissions and\n#   limitations under the License.\n#\n------------------------------------------------------------------------------\u003e\n\njson_parser\n===========\n\nLightweight, header only DOM json_parser. Fairly fast and fairly light. Built to handle most JSON. Any encoded/escaped test fields in the JSON will still be encoded/escaped after they are parsed. It is up to the user to decide which fields need unencoding.\n\nSo far I have only compared json_parser's speed against rapidjson. For those comparisons I parsed 140MB of JSON which had 100K objects. Each object had 30 key/value pairs with string values. Each object also had an array of 50 numbers (doubles). The closest I came was 1.8 times slower than rapidjson. Each test run was a separate run of the process. After parsing the JSON, each test walked through the resuls checking the validity of the values.\n\n    json_parser: 141533401 bytes, objects: 100000, numbers: 50, attributes: 30, parse us: 1465640, check us: 1750130     // -O2\n    json_parser: 141533401 bytes, objects: 100000, numbers: 50, attributes: 30, parse us: 1374260, check us: 1701616     // -O3\n    rapidjson:   141533401 bytes, objects: 100000, numbers: 50, attributes: 30, parse us: 819425,  check us: 1767048\n    rapidjson:   141533401 bytes, objects: 100000, numbers: 50, attributes: 30, parse us: 811476,  check us: 1766306 \n\nExample Usage: \n\n    // This example is fully coded in the examples dir.\n    std::string json_buffer;\n    // fill json_buffer with json data from somewhere (file, HTTP, TCP, etc)\n    // Assuming that the JSON has an object with a temperature value which has key/values for the months, each month having an array of temps.\n    // {\"temperature\":{\"January\":[1,2,3...4],....\"March\":[40,40,....46,47]}}\n    ....\n    json::root root(json_buffer);\n    if (root.is_unset())\n            // return failure\n    json::value\u0026 temp = root[\"temperature\"];\n    if (temp.is_unset()) // return failure\n    json::value\u0026 march = temp[\"March\"];\n    if (march.is_unset()) // return failure\n    double march15 = march[15].numb()\n    \nThe whitebox tests are the only files that need built. The rest of the files are header only implementations so just include them and use them.\n\nBuild the whitebox tests (out-of-tree suggested):\n\n    mkdir -p build \u0026\u0026 cd build;\n    cmake -DCMAKE_BUILD_TYPE=Release -G \"Unix Makefiles\" ..\n    make\n    make test\n\nBuild the whitebox tests for profiling with gcov:\n\n    mkdir -p build \u0026\u0026 cd build;\n    cmake -DCMAKE_BUILD_TYPE=Debug -G \"Unix Makefiles\" ..\n    make\n    make test\n\nNote: The whitebox_aton test takes a while because it is doing timings. There is a noticable difference in the time to run it between Release and Debug.\n\n\nHelper Classes\n--------------\n\nThey are packaged here as helper classes, however their uses potentially extend beyond just this application.\n\n`subbuffer`: A const char* and length wrapped into a class with easy to understand methods added. Unless we specifically need a NULL terminated string, subbuffers are passed in all new code instead of `const char*` and `const string\u0026`.\n\n`subparser`: Parses `subbuffers` with a user supplied delimiter. The delimiter can be a `char`, `chargrp` or another `subbuffer`.\n\n`aton`: Performs alphanumeric to numeric conversions on `subbuffers`.\n\n`chargrp`: A set of ascii chars (0-255) used for comparisons. If you want to match on a char in a group of user specified chars in any order, this works.\n\n`json_array` and `json_object`: Provides an easy way of building JSON output.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedgio%2Fjson_parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedgio%2Fjson_parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedgio%2Fjson_parser/lists"}