{"id":23080219,"url":"https://github.com/olemorud/json-parser","last_synced_at":"2026-05-03T06:32:59.850Z","repository":{"id":158250346,"uuid":"632034535","full_name":"olemorud/json-parser","owner":"olemorud","description":"JSON parser in C","archived":false,"fork":false,"pushed_at":"2023-06-05T20:37:29.000Z","size":3803,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T13:44:34.367Z","etag":null,"topics":["c","json","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":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/olemorud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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-04-24T15:14:17.000Z","updated_at":"2023-05-02T07:25:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"c53fd28f-8f31-4bf8-be72-40c84bfd5edc","html_url":"https://github.com/olemorud/json-parser","commit_stats":null,"previous_names":["olemorud/json-parser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/olemorud/json-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olemorud%2Fjson-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olemorud%2Fjson-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olemorud%2Fjson-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olemorud%2Fjson-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olemorud","download_url":"https://codeload.github.com/olemorud/json-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olemorud%2Fjson-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32560416,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T03:21:47.309Z","status":"ssl_error","status_checked_at":"2026-05-03T03:21:43.884Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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","json-parser"],"created_at":"2024-12-16T13:05:51.545Z","updated_at":"2026-05-03T06:32:59.832Z","avatar_url":"https://github.com/olemorud.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# C JSON Parser\n\nJust a simple project to practice writing parsers.\nNot guaranteed to be safe, reliable or efficient.\n\n## Usage\n\n###  Compile\n\nbuild (release build):\n\n```sh\nmake BUILD=release\n```\n\nTo make a debug build just run `make`.\n\n### Run\n\n```sh\n./bin/release/json_parser  sample-files/large-file.json\n```\n\n## Implementation\n\nParsed JSON values are stored as structs containing type information and data.\n\n```c\nenum json_type { object, array, string, number, boolean, null };\n\nstruct json_value {\n    enum json_type type;\n\n    union {\n        obj_t*              object;\n        struct json_value** array;\n        char*               string;\n        bool                boolean;\n        double              number;\n    };\n};\n```\n\n### Types\n\n#### JSON Objects\n\nObject values have the type field set to `(enum json_type) object`\n\nThey are stored using a poorly written map implementation with the type `obj_t`\nin `json_value.object`\n\nSee [obj_t](#obj_t) for more details.\n\n#### JSON Arrays\n\nArray values have the type field set to `(enum json_type) array`\n\nJSON Arrays are stored as null-terminated `json_value*` arrays,\ni.e. `struct json_value**`, in `json_value.array`\n\n\n#### JSON Numbers\n\nNumber values have the type field set to `(enum json_type) number`\n\nNumbers are stored as `double` values in `json_value.number`\n\n(The JSON specification doesn't strictly specify a maximum value, \nbut `double` is sufficient for parsing almost all JSON data.)\n\n\n#### JSON Strings\n\nStrings have the type field set to `(enum json_type) string`\n\nStrings are stored as null-terminated char arrays, `char*`, in `json_value.string`\n\n\n#### JSON Booleans\n\nBoolean values have the type field set to `(enum json_type) boolean`\n\nThe values are stored as `bool` in `json_value.boolean`\n\n\n#### JSON Null\n\nNull values have type field set to `(enum json_type) null`.\n\n\n### obj\\_t\n\n`obj_t` is defined in `json_value.h` as:\n```c\ntypedef struct obj_entry {\n    char const* key;\n    struct json_value* val;\n    struct obj_entry* next;\n} * __p_obj_entry;\n\ntypedef __p_obj_entry obj_t[OBJ_SIZE]; // OBJ_SIZE=1024\n```\n\n#### obj\\_t methods\n\n`void* obj_at(obj_t m, char* key)`\n\nReturns a pointer to a value for the given key.\n\n`bool obj_insert(obj_t m, char* const key, struct json_value* value)`\n\nInsert a key-value pair\n\n`void obj_delete(obj_t m)`\n\nRecursively free memory allocated for object and children objects.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folemorud%2Fjson-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folemorud%2Fjson-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folemorud%2Fjson-parser/lists"}