{"id":41399367,"url":"https://github.com/mrryanjohnston/validatejson","last_synced_at":"2026-01-23T13:04:07.978Z","repository":{"id":192917314,"uuid":"672594754","full_name":"mrryanjohnston/validatejson","owner":"mrryanjohnston","description":"JSON Validator","archived":false,"fork":false,"pushed_at":"2025-04-25T02:49:35.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-25T03:34:41.598Z","etag":null,"topics":["c","cli","json","validation"],"latest_commit_sha":null,"homepage":"https://ryjo.codes/articles/a-json-validator-in-c.html","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/mrryanjohnston.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,"zenodo":null}},"created_at":"2023-07-30T16:03:27.000Z","updated_at":"2025-04-25T02:49:39.000Z","dependencies_parsed_at":"2023-09-05T23:39:58.428Z","dependency_job_id":"beec606f-83a2-4eca-9f68-58fdb49acc53","html_url":"https://github.com/mrryanjohnston/validatejson","commit_stats":{"total_commits":66,"total_committers":1,"mean_commits":66.0,"dds":0.0,"last_synced_commit":"089be81ef94c738fd6f42ad75a17cb45b49c9b97"},"previous_names":["mrryanjohnston/validatejson"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrryanjohnston/validatejson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrryanjohnston%2Fvalidatejson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrryanjohnston%2Fvalidatejson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrryanjohnston%2Fvalidatejson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrryanjohnston%2Fvalidatejson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrryanjohnston","download_url":"https://codeload.github.com/mrryanjohnston/validatejson/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrryanjohnston%2Fvalidatejson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28692677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T11:01:27.039Z","status":"ssl_error","status_checked_at":"2026-01-23T11:00:26.909Z","response_time":59,"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","cli","json","validation"],"created_at":"2026-01-23T13:04:07.521Z","updated_at":"2026-01-23T13:04:07.967Z","avatar_url":"https://github.com/mrryanjohnston.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# validatejson\n\n## Description\n\n`validatejson` checks whether the argument passed is a valid string of JSON\nas defined by\n[RFC 8259](https://datatracker.ietf.org/doc/html/rfc8259).\nIt takes a lot of cues implementation-wise from\n[`jsmn`](https://github.com/zserge/jsmn), but it only validates the passed string.\n\n## Why Another JSON Validator?\n\nI really like the aformentioned `jsmn`'s approach to algorithmically parsing\na string. However, it initializes structs for every complete token parsed.\nI wanted something that avoided using `structs` to store references\nto the parsed tokens since I only want to validate the string.\nI'm hoping this leads to some very fast validations at the cost of\nfunctionality (no ability to reference previously parsed tokens).\n\n## Usage\n\nUse `make` to compile the `validatejson` binary:\n\n```\n$ make\ngcc -c validatejson.c\ngcc -o validatejson main.c validatejson.o\n```\n\nRunning `./validatejson` with no arguments will\ndisplay the USAGE text:\n\n```\n$ ./validatejson \nUSAGE\nvalidatejson checks whether the argument passed is a valid string of JSON\n\nExample:\n        validatejson '{ \"foo\": [ 1, 2, \"Bar!\" ] }'\n```\n\nTo validate a string of potential json, pass it as the first argument:\n\n```\n$ ./validatejson '{ \"foo\": [ 1, 2, \"Bar!\" ] }'\nPASS\n```\n\nTo use the `validateJSON` function in your C code, copy the\n`validatejson.h` and `validatejson.c` files into the same directory\nas your C file. Here is an example C file that uses the `validateJSON`\nfunction:\n\n```c\n#include \"validatejson.h\"\n\nint main(int argc, char *argv[])\n{\n\tif (argc == 1 \u0026\u0026 validateJSON(argv[1]))\n\t{\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\treturn -1;\n\t}\n}\n```\n\n## Development\n\nUse `make clean` to remove the compiled binary and object headers:\n\n```\n$ make clean\nrm validatejson validatejson.o\n```\n\nIf you find a bug, add a file containing valid or invalid JSON\nto either the `tests/valid` or `tests/invalid` directories.\n\n## Testing\n\nTo compile and run the \"test suite:\"\n\n```\n$ make test\ngcc -c validatejson.c\ngcc -o tests/test tests/test.c validatejson.o\n./tests/test\nTest results:\n================\nPASS\nrm ./tests/test validatejson.o\n```\n\n## Profiling\n\nUse `make profile` to see \n[the output from `gprof`](https://ftp.gnu.org/old-gnu/Manuals/gprof-2.9.1/html_chapter/gprof_5.html)\nof running the test suite.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrryanjohnston%2Fvalidatejson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrryanjohnston%2Fvalidatejson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrryanjohnston%2Fvalidatejson/lists"}