{"id":23327996,"url":"https://github.com/andy-byers/mewjson","last_synced_at":"2026-04-25T11:36:13.813Z","repository":{"id":209930370,"uuid":"724875318","full_name":"andy-byers/mewjson","owner":"andy-byers","description":"a tiny JSON library","archived":false,"fork":false,"pushed_at":"2023-12-13T21:17:39.000Z","size":185,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-03T11:30:41.612Z","etag":null,"topics":["c","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andy-byers.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,"publiccode":null,"codemeta":null}},"created_at":"2023-11-29T01:01:24.000Z","updated_at":"2025-05-10T18:31:39.000Z","dependencies_parsed_at":"2023-12-12T18:18:21.153Z","dependency_job_id":"7606017c-b0fb-4831-9dd4-18af1928ae0f","html_url":"https://github.com/andy-byers/mewjson","commit_stats":null,"previous_names":["andy-byers/mewjson"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andy-byers/mewjson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andy-byers%2Fmewjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andy-byers%2Fmewjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andy-byers%2Fmewjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andy-byers%2Fmewjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andy-byers","download_url":"https://codeload.github.com/andy-byers/mewjson/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andy-byers%2Fmewjson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32261117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T09:15:33.318Z","status":"ssl_error","status_checked_at":"2026-04-25T09:15:31.997Z","response_time":59,"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":["c","json","parser"],"created_at":"2024-12-20T20:54:07.090Z","updated_at":"2026-04-25T11:36:08.799Z","avatar_url":"https://github.com/andy-byers.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e NOTE: This library is under active development.\n\u003e Please don't use it for anything important!\n\n# mewjson\na tiny JSON library\n\n## Requirements\nThe library requires the following to compile:\n+ CMake version 3.14 or later\n+ C compiler with support for C11\n\n## Features\n+ Stores whole numbers between -9223372036854775808 and 9223372036854775807, inclusive, as 64-bit signed integers\n+ Uses a packed parse tree representation to save memory\n\n## Caveats\n+ Only supports DOM-style (parse tree-based) parsing\n+ Parser uses dynamic memory\n+ Real number handling is slow and breaks in certain locales (uses `strtod()` and `snprintf()`)\n+ Parse tree is immutable\n\n## API\nmewjson aims to provide a small, convenient API for parsing and validating JSON data.\n\n### Initialize a parser\nThe second parameter to `jsonParserInit()` is a pointer to `struct JsonAllocator`.\nIf nonnull, the provided allocation functions are used to get memory for the parser.\nOtherwise, the standard C allocation routines `malloc`, `realloc`, and `free` are used.\n```C\nstruct JsonParser parser;\nstruct JsonAllocator a = {/* user-defined allocation functions go here */};\njsonParserInit(\u0026parser, \u0026a); // Must be called prior to jsonParse()\n```\n\n### Parse a JSON document\nThe callbacks in `h` are called as values and structural elements are encountered during the parse.\nThe input buffer does not need to be null-terminated.\n```C\nstatic const char kJson[] = \"[1,[2,[3],4],5]\";\nJsonDocument *doc = jsonParse(kJson, (JsonSize)strlen(kJson), \u0026parser);\nif (!doc) {\n    // parser.status indicates what went wrong, and parser.offset indicates where in the input\n    // buffer the parser stopped.\n    fprintf(stderr, \"parser error %d at offset %ld\\n\",\n            parser.status, parser.offset);\n    abort();\n}\n```\n\n### Cleanup\n```C\njsonDestroyDocument(doc);\n```\n\n## TODO\n+ Document the rest of the current API (jsonWrite(), jsonCloneDocument())\n+ Prefix the document encoding with a checksum over all of its bytes\n+ Allow direct access to the binary encoding (it can be saved and loaded, using the checksum for validation)\n+ Consider supporting JSON patch and/or JSON merge patch\n  + Would have to be an API that takes 2 documents and returns another one, since the parse trees aren't easy to modify\n  + Makes `jsonWrite()` much more useful\n## Credits\n+ The awesome folks on [this r/C_Programming thread](https://www.reddit.com/r/C_Programming/comments/18aqehf/json_parser_project/) (posted around 6983ae8), who were kind enough to review this project\n+ Variable-length integer encoding/decoding functions were modified from LevelDB\n+ Logic for decoding integers is from SQLite's JSON module\n+ Idea to use a packed representation is from SQLite's JSONB module\n+ State transition lookup table was inspired by rapidjson\n+ Signed varint encoding is from the Go repo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandy-byers%2Fmewjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandy-byers%2Fmewjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandy-byers%2Fmewjson/lists"}