{"id":22878060,"url":"https://github.com/orcalinux/c-json","last_synced_at":"2026-02-01T00:10:31.608Z","repository":{"id":264577876,"uuid":"893737021","full_name":"orcalinux/c-json","owner":"orcalinux","description":"A lightweight, fast, and cross-platform JSON parsing library for C developers. C-JSON simplifies JSON handling in C, supporting objects, arrays, strings, numbers, booleans, and null values with minimal memory overhead.","archived":false,"fork":false,"pushed_at":"2024-11-29T08:51:16.000Z","size":97,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T14:18:32.901Z","etag":null,"topics":["json","json-parser","parser","parsing","scanner"],"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/orcalinux.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-11-25T05:48:34.000Z","updated_at":"2025-01-27T21:16:29.000Z","dependencies_parsed_at":"2025-02-06T20:32:35.735Z","dependency_job_id":null,"html_url":"https://github.com/orcalinux/c-json","commit_stats":null,"previous_names":["orcalinux/json-parser","orcalinux/c-json-"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orcalinux%2Fc-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orcalinux%2Fc-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orcalinux%2Fc-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orcalinux%2Fc-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orcalinux","download_url":"https://codeload.github.com/orcalinux/c-json/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252957786,"owners_count":21831551,"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":["json","json-parser","parser","parsing","scanner"],"created_at":"2024-12-13T16:17:46.594Z","updated_at":"2026-02-01T00:10:31.526Z","avatar_url":"https://github.com/orcalinux.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **C-JSON**\n\n_A lightweight and efficient JSON parsing library for C applications._\n\n---\n\n## **Overview**\n\nC-JSON is a minimal yet robust JSON parsing library designed for developers who need fast and efficient JSON handling in C. Whether you're building embedded systems, working on performance-critical applications, or integrating JSON into your C projects, C-JSON provides the tools you need with minimal overhead.\n\nWith features like handling deeply nested structures, simple API integration, and comprehensive error handling, C-JSON ensures a smooth experience while processing JSON data efficiently.\n\n---\n\n## **Features**\n\n- **Lightweight and Fast**: Built for performance and low memory usage.\n- **Comprehensive Parsing**:\n  - JSON Objects\n  - Arrays\n  - Strings\n  - Numbers (integers and floating-point)\n  - Booleans\n  - Null values\n- **Supports Nested Structures**: Handles deeply nested objects and arrays effortlessly.\n- **Intuitive API**: Easy-to-use functions for seamless integration.\n- **Error Handling**: Identifies and reports malformed JSON with helpful messages.\n- **Cross-Platform**: Compatible with Linux, macOS, and Windows.\n\n---\n\n## **Quick Start**\n\n### **Installation**\n\n1. **Clone the Repository**  \n   Get the source code from GitHub:\n\n   ```bash\n   git clone https://github.com/OrcaLinux/c-json.git\n   cd c-json\n   ```\n\n2. **Build the Library**  \n   Compile the library using the provided Makefile:\n\n   ```bash\n   make\n   ```\n\n3. **Run Tests**  \n   Verify that the library is functioning as expected:\n\n   ```bash\n   make test\n   ```\n\n---\n\n### **Integration**\n\n1. Include the header file in your source code:\n\n   ```c\n   #include \"json_parser.h\"\n   ```\n\n2. Link the library during compilation:\n\n   ```bash\n   gcc -o my_program my_program.c -Lpath/to/json-parser/build -ljsonparser\n   ```\n\n---\n\n## **Usage**\n\n### **Example: Parsing a Simple JSON Object**\n\n```c\n#include \"json_parser.h\"\n#include \u003cstdio.h\u003e\n\nint main() {\n    const char* json_str = \"{ \\\"name\\\": \\\"C-JSON\\\", \\\"version\\\": 1.0, \\\"active\\\": true }\";\n\n    JsonValue* root = json_parse(json_str);\n    if (!root) {\n        printf(\"Failed to parse JSON.\\n\");\n        return 1;\n    }\n\n    // Access object values\n    JsonValue* name = json_object_get(root, \"name\");\n    JsonValue* version = json_object_get(root, \"version\");\n    JsonValue* active = json_object_get(root, \"active\");\n\n    if (name \u0026\u0026 name-\u003etype == JSON_STRING)\n        printf(\"Name: %s\\n\", name-\u003evalue.string);\n    if (version \u0026\u0026 version-\u003etype == JSON_NUMBER)\n        printf(\"Version: %.1f\\n\", version-\u003evalue.number);\n    if (active \u0026\u0026 active-\u003etype == JSON_BOOL)\n        printf(\"Active: %s\\n\", active-\u003evalue.boolean ? \"true\" : \"false\");\n\n    json_free_value(root);\n    return 0;\n}\n```\n\n---\n\n### **Example: Handling Nested Structures**\n\n```c\n#include \"json_parser.h\"\n#include \u003cstdio.h\u003e\n\nint main() {\n    const char* json_str = \"{ \\\"user\\\": { \\\"name\\\": \\\"Alice\\\", \\\"age\\\": 25 }, \\\"hobbies\\\": [\\\"reading\\\", \\\"swimming\\\"] }\";\n\n    JsonValue* root = json_parse(json_str);\n    if (!root) {\n        printf(\"Failed to parse JSON.\\n\");\n        return 1;\n    }\n\n    // Access nested objects\n    JsonValue* user = json_object_get(root, \"user\");\n    if (user \u0026\u0026 user-\u003etype == JSON_OBJECT) {\n        JsonValue* name = json_object_get(user, \"name\");\n        JsonValue* age = json_object_get(user, \"age\");\n\n        if (name \u0026\u0026 name-\u003etype == JSON_STRING)\n            printf(\"Name: %s\\n\", name-\u003evalue.string);\n        if (age \u0026\u0026 age-\u003etype == JSON_NUMBER)\n            printf(\"Age: %.0f\\n\", age-\u003evalue.number);\n    }\n\n    // Access arrays\n    JsonValue* hobbies = json_object_get(root, \"hobbies\");\n    if (hobbies \u0026\u0026 hobbies-\u003etype == JSON_ARRAY) {\n        printf(\"Hobbies:\\n\");\n        for (size_t i = 0; i \u003c hobbies-\u003evalue.array-\u003ecount; i++) {\n            JsonValue* hobby = hobbies-\u003evalue.array-\u003eitems[i];\n            if (hobby \u0026\u0026 hobby-\u003etype == JSON_STRING)\n                printf(\"- %s\\n\", hobby-\u003evalue.string);\n        }\n    }\n\n    json_free_value(root);\n    return 0;\n}\n```\n\n---\n\n## **Directory Structure**\n\n```\n.\n├── examples/\n│   └── example_usage.c      # Example application showcasing library usage\n├── include/\n│   ├── json_accessor.h      # JSON accessor API header\n│   ├── json_config.h        # Configuration file for JSON settings, e.g., debug flags\n│   ├── json_logging.h       # Header for logging-related macros or functions\n│   ├── json_parser.h        # Main parser API header\n│   ├── json_printer.h       # JSON pretty-printing API header\n│   ├── json_tokenizer.h     # Tokenizer API header\n│   ├── json_types.h         # JSON type definitions\n│   └── json_utils.h         # Utility functions header (memory management, etc.)\n├── LICENSE                  # Project license\n├── Makefile                 # Build instructions\n├── README.md                # Project documentation\n├── src/\n│   ├── json_accessor.c      # Implementation of accessor functions\n│   ├── json_config.c        # Implementation for configuration (not needed till now)\n│   ├── json_logging.c       # Implementation for logging functionality (not needed till now)\n│   ├── json_parser.c        # Implementation of the JSON parser\n│   ├── json_printer.c       # Implementation of the JSON printer\n│   ├── json_tokenizer.c     # Implementation of the tokenizer\n│   └── json_utils.c         # Implementation of utility functions\n└── tests/\n    ├── test_parser.c        # Unit tests for the JSON parser\n    └── test_tokenizer.c     # Unit tests for the tokenizer\n```\n\n---\n\n## **Contributing**\n\nContributions are welcome! To contribute:\n\n1. Fork the repository.\n2. Create a feature branch:\n   ```bash\n   git checkout -b feature/AmazingFeature\n   ```\n3. Commit your changes:\n   ```bash\n   git commit -m \"Add AmazingFeature\"\n   ```\n4. Push your branch:\n   ```bash\n   git push origin feature/AmazingFeature\n   ```\n5. Open a pull request.\n\n---\n\n## **Roadmap**\n\n- [ ] Add JSON serialization support.\n- [ ] Optimize parsing for large JSON files.\n- [ ] Add detailed error reporting.\n- [ ] Include performance benchmarks.\n\n---\n\n## **License**\n\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\n\n---\n\n## **Acknowledgments**\n\n- Inspired by the simplicity and versatility of JSON.\n- Thanks to all contributors and open-source advocates.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forcalinux%2Fc-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forcalinux%2Fc-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forcalinux%2Fc-json/lists"}