{"id":18794818,"url":"https://github.com/metan-ucw/ujson","last_synced_at":"2026-02-24T05:42:37.245Z","repository":{"id":77805604,"uuid":"340898477","full_name":"metan-ucw/ujson","owner":"metan-ucw","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-04T12:03:22.000Z","size":402,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T06:22:54.230Z","etag":null,"topics":["c","json","minimalistic","parser"],"latest_commit_sha":null,"homepage":"https://metan-ucw.github.io/ujson/","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/metan-ucw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-02-21T12:40:16.000Z","updated_at":"2024-12-04T12:03:27.000Z","dependencies_parsed_at":"2024-08-27T12:43:44.064Z","dependency_job_id":"6a2ae03c-c817-42db-b0e7-be78c2797f82","html_url":"https://github.com/metan-ucw/ujson","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/metan-ucw%2Fujson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metan-ucw%2Fujson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metan-ucw%2Fujson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metan-ucw%2Fujson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metan-ucw","download_url":"https://codeload.github.com/metan-ucw/ujson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248736098,"owners_count":21153533,"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","minimalistic","parser"],"created_at":"2024-11-07T21:31:10.259Z","updated_at":"2025-10-24T02:31:39.084Z","avatar_url":"https://github.com/metan-ucw.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"UJSON\n=====\n\nUJSON is:\n\n- Complete and simple JSON reader and writer written in C\n- Produces nice and human readable error messages\n- Passes [JSONTestSuite](https://github.com/nst/JSONTestSuite)\n\nSee generated documentation at: https://metan-ucw.github.io/ujson/files.html\n\nThe key point of this parser is that:\n\n- works on a buffer in a memory that is _not_ modified during the parsing\n- parser does not allocate memory\n- nearly stateless, the only state the parser maintains is an offset to the\n  string buffer, recursion depth and error flag\n- if error flag is raised all parser functions return immediatelly with error\n\nThe parser is started by a call to `ujson_start()` function in order to\ndetermine if first element in the buffer is object or an array.\n\n```c\n\tswitch (ujson_reader_start(reader)) {\n\tcase UJSON_ARR:\n\t\t//parse array\n\tbreak;\n\tcase UJSON_OBJ:\n\t\t//parse object\n\tbreak;\n\tdefault:\n\tbreak;\n\t}\n\n\tif (ujson_reader_err(reader))\n\t\tujson_err_print(reader);\n\n```\n\nThen you can loop recursively over arrays and objects with:\n\n```c\n\tchar sbuf[128];\n\tstruct ujson_val json = {.buf = sbuf, .buf_size = sizeof(sbuf)};\n\n\tUJSON_OBJ_FOREACH(reader, \u0026json) {\n\t\tswitch (json.type) {\n\t\tcase UJSON_OBJ:\n\t\t\t//parse object\n\t\tbreak;\n\t\tcase UJSON_ARR:\n\t\t\t//parse array\n\t\tbreak;\n\t\tcase UJSON_STR:\n\t\t...\n\n\t\t}\n\t}\n```\n\n\nThe supported types are:\n\n* UJSON\\_ARR - an array, needs to be parsed recursivelly\n* UJSON\\_OBJ - an object, needs to be parsed recursivelly\n* UJSON\\_INT - an integer number stored as val\\_int (also sets val\\_float for convinience)\n* UJSON\\_FLOAT - a floating point number stored as val\\_float\n* UJSON\\_BOOL - a boolean stored as val\\_bool\n* UJSON\\_NULL - a null has no value\n* UJSON\\_STR - a string, stored in user supplied buffer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetan-ucw%2Fujson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetan-ucw%2Fujson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetan-ucw%2Fujson/lists"}