{"id":13730326,"url":"https://github.com/mjansson/json","last_synced_at":"2025-10-23T17:52:27.994Z","repository":{"id":151421843,"uuid":"58915528","full_name":"mjansson/json","owner":"mjansson","description":"Single file in-place JSON/SJSON parser","archived":false,"fork":false,"pushed_at":"2021-07-27T19:53:50.000Z","size":20,"stargazers_count":76,"open_issues_count":0,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-09T00:53:21.680Z","etag":null,"topics":["c","json","sjson"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjansson.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}},"created_at":"2016-05-16T08:18:21.000Z","updated_at":"2025-03-17T14:33:34.000Z","dependencies_parsed_at":"2023-06-01T10:47:23.789Z","dependency_job_id":null,"html_url":"https://github.com/mjansson/json","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjansson%2Fjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjansson%2Fjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjansson%2Fjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjansson%2Fjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjansson","download_url":"https://codeload.github.com/mjansson/json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171235,"owners_count":21865288,"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":["c","json","sjson"],"created_at":"2024-08-03T02:01:13.313Z","updated_at":"2025-10-23T17:52:22.946Z","avatar_url":"https://github.com/mjansson.png","language":"C","readme":"# JSON/SJSON parser - Public Domain\nIn-place JSON/SJSON parser implemented in a single header file. No memory allocation, all operations are done in-place. The latest source code is always available at https://github.com/mjansson/json\n\nCreated by Mattias Jansson ([@maniccoder](https://twitter.com/maniccoder))\n\nDiscord server for discussions https://discord.gg/M8BwTQrt6c\n\nThis library is put in the public domain; you can redistribute it and/or modify it without any restrictions.\n\n# Overview\n\nSmall in-place JSON parser without any allocation. Entry points for both\nstandard JSON and simplified JSON data parsing. All character data must be\nin UTF-8 format.\n\nStrings are not automatically unescaped. Use json_unescape/json_escape to\nperform unescaping and espacing of strings. Unescaping can be done in-place\nto avoid memory allocations.\n\nSimplified JSON as parsed by this library has the following differences\nfrom standard JSON:\n- The equal sign = is used to define key-value pairs instead of the colon :\n- Quotes around string keys in key-value pairs are optional, unless you need\nthe key to contain either whitespace or the equal sign =\n- Commas are optional in object and array definitions\n- Each SJSON file is always interpreted as a definition for a single object.\nYou can think of this as an implicit set of curly quotes { ... } that surround\nthe contents of the file\n\nRequires size_t, bool and memcmp to be declared prior to including this\nheader. Headers are only included  when compiled as the minimal test case.\n\nTo compile the minimal test case, use\ngcc -D JSON_TEST -x c --std=c99 json.h\n\nKudos to Niklas Gray for SJSON syntax,\nhttp://bitsquid.blogspot.se/2009/10/simplified-json-notation.html\n\n# Usage\n\n\tjson_size_t\n\tjson_parse(const char* buffer, json_size_t size,\n\t           struct json_token_t* tokens, json_size_t capacity);\n\n\tstatic json_size_t\n\tsjson_parse(const char* buffer, json_size_t size,\n\t            struct json_token_t* tokens, json_size_t capacity);\n\nParse the given memory buffer as JSON or SJSON into the given token array of\ngiven capacity. Returns the number of parsed tokens, which can be greater\nthan the supplied capacity to indicate the need for a larger array.\n\nString identifiers and values are not unescaped. This must be performed manually\non each string of interest.\n\n\tstatic json_size_t\n\tjson_unescape(char* buffer, json_size_t capacity, const char* string, json_size_t length);\n\nUnescape a JSON identifier or value string. Buffer can be\npointing to same memory area as string (in-place unescaping).\n\n\tstatic json_size_t\n\tjson_escape(char* buffer, json_size_t capacity, const char* string, json_size_t length);\n\nEscape a JSON identifier or value string. Buffer can NOT be\npointing to same memory area as string.\n\n\tstatic bool\n\tjson_string_equal(const char* rhs, size_t rhs_length, const char* lhs, size_t lhs_length);\n\nUtility function to do bounded string compare.\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjansson%2Fjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjansson%2Fjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjansson%2Fjson/lists"}