{"id":19775044,"url":"https://github.com/freertos/corejson","last_synced_at":"2025-04-05T03:01:43.337Z","repository":{"id":37493655,"uuid":"290621225","full_name":"FreeRTOS/coreJSON","owner":"FreeRTOS","description":"A parser strictly enforcing the ECMA-404 JSON standard, suitable for microcontrollers","archived":false,"fork":false,"pushed_at":"2024-11-25T05:56:00.000Z","size":885,"stargazers_count":115,"open_issues_count":1,"forks_count":68,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-03-29T02:01:36.466Z","etag":null,"topics":[],"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/FreeRTOS.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-26T22:51:15.000Z","updated_at":"2025-03-18T21:49:03.000Z","dependencies_parsed_at":"2023-02-01T12:02:22.586Z","dependency_job_id":"3b496f49-3d1f-498e-b2d5-96491e9b1b9d","html_url":"https://github.com/FreeRTOS/coreJSON","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeRTOS%2FcoreJSON","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeRTOS%2FcoreJSON/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeRTOS%2FcoreJSON/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeRTOS%2FcoreJSON/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FreeRTOS","download_url":"https://codeload.github.com/FreeRTOS/coreJSON/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280190,"owners_count":20912966,"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":[],"created_at":"2024-11-12T05:14:43.825Z","updated_at":"2025-04-05T03:01:43.219Z","avatar_url":"https://github.com/FreeRTOS.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## coreJSON Library\n\n**[API Documentation Pages for current and previous releases of this library can be found here](https://freertos.github.io/coreJSON/)**\n\nThis repository contains the coreJSON library, a parser that strictly enforces\nthe ECMA-404 JSON standard and is suitable for low memory footprint embedded\ndevices. The coreJSON library is distributed under the\n[MIT Open Source License](LICENSE).\n\nThis library has gone through code quality checks including verification that no\nfunction has a\n[GNU Complexity](https://www.gnu.org/software/complexity/manual/complexity.html)\nscore over 8, and checks against deviations from mandatory rules in the\n[MISRA coding standard](https://www.misra.org.uk). Deviations from the MISRA\nC:2012 guidelines are documented under [MISRA Deviations](MISRA.md). This\nlibrary has also undergone both static code analysis from\n[Coverity static analysis](https://scan.coverity.com/), and validation of memory\nsafety through the\n[CBMC automated reasoning tool](https://www.cprover.org/cbmc/).\n\nSee memory requirements for this library\n[here](./docs/doxygen/include/size_table.md).\n\n**coreJSON v3.3.0\n[source code](https://github.com/FreeRTOS/coreJSON/tree/v3.3.0/source) is part\nof the\n[FreeRTOS 202406.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202406.00-LTS)\nrelease.**\n\n## Reference example\n\n```c\n#include \u003cstdio.h\u003e\n#include \"core_json.h\"\n\nint main()\n{\n    // Variables used in this example.\n    JSONStatus_t result;\n    char buffer[] = \"{\\\"foo\\\":\\\"abc\\\",\\\"bar\\\":{\\\"foo\\\":\\\"xyz\\\"}}\";\n    size_t bufferLength = sizeof( buffer ) - 1;\n    char queryKey[] = \"bar.foo\";\n    size_t queryKeyLength = sizeof( queryKey ) - 1;\n    char * value;\n    size_t valueLength;\n\n    // Calling JSON_Validate() is not necessary if the document is guaranteed to be valid.\n    result = JSON_Validate( buffer, bufferLength );\n\n    if( result == JSONSuccess )\n    {\n        result = JSON_Search( buffer, bufferLength, queryKey, queryKeyLength,\n                              \u0026value, \u0026valueLength );\n    }\n\n    if( result == JSONSuccess )\n    {\n        // The pointer \"value\" will point to a location in the \"buffer\".\n        char save = value[ valueLength ];\n        // After saving the character, set it to a null byte for printing.\n        value[ valueLength ] = '\\0';\n        // \"Found: bar.foo -\u003e xyz\" will be printed.\n        printf( \"Found: %s -\u003e %s\\n\", queryKey, value );\n        // Restore the original character.\n        value[ valueLength ] = save;\n    }\n\n    return 0;\n}\n```\n\nA search may descend through nested objects when the `queryKey` contains\nmatching key strings joined by a separator, `.`. In the example above, `bar` has\nthe value `{\"foo\":\"xyz\"}`. Therefore, a search for query key `bar.foo` would\noutput `xyz`.\n\n## Building coreJSON\n\nA compiler that supports **C90 or later** such as _gcc_ is required to build the\nlibrary.\n\nAdditionally, the library uses 2 header files introduced in ISO C99, `stdbool.h`\nand `stdint.h`. For compilers that do not provide this header file, the\n[source/include](source/include) directory contains\n[stdbool.readme](source/include/stdbool.readme) and\n[stdint.readme](source/include/stdint.readme), which can be renamed to\n`stdbool.h` and `stdint.h` respectively.\n\nFor instance, if the example above is copied to a file named `example.c`, _gcc_\ncan be used like so:\n\n```bash\ngcc -I source/include example.c source/core_json.c -o example\n./example\n```\n\n_gcc_ can also produce an output file to be linked:\n\n```bash\ngcc -I source/include -c source/core_json.c\n```\n\n## Documentation\n\n### Existing documentation\n\nFor pre-generated documentation, please see the documentation linked in the\nlocations below:\n\n|                                                       Location                                                       |\n| :------------------------------------------------------------------------------------------------------------------: |\n| [AWS IoT Device SDK for Embedded C](https://github.com/aws/aws-iot-device-sdk-embedded-C#releases-and-documentation) |\n|       [GitHub.io](https://freertos.github.io/coreJSON/v3.3.0/)        |\n\nNote that the latest included version of the coreJSON library may differ across\nrepositories.\n\n### Generating documentation\n\nThe Doxygen references were created using Doxygen version 1.9.6. To generate the\nDoxygen pages, please run the following command from the root of this\nrepository:\n\n```shell\ndoxygen docs/doxygen/config.doxyfile\n```\n\n## Building unit tests\n\n### Checkout Unity Submodule\n\nBy default, the submodules in this repository are configured with `update=none`\nin [.gitmodules](.gitmodules), to avoid increasing clone time and disk space\nusage of other repositories (like\n[amazon-freertos](https://github.com/aws/amazon-freertos) that submodules this\nrepository).\n\nTo build unit tests, the submodule dependency of Unity is required. Use the\nfollowing command to clone the submodule:\n\n```\ngit submodule update --checkout --init --recursive test/unit-test/Unity\n```\n\n### Platform Prerequisites\n\n- For running unit tests\n  - C90 compiler like gcc\n  - CMake 3.13.0 or later\n  - Ruby 2.0.0 or later is additionally required for the Unity test framework\n    (that we use).\n- For running the coverage target, gcov is additionally required.\n\n### Steps to build Unit Tests\n\n1. Go to the root directory of this repository. (Make sure that the **Unity**\n   submodule is cloned as described [above](#checkout-unity-submodule).)\n\n1. Create build directory: `mkdir build \u0026\u0026 cd build`\n\n1. Run _cmake_ while inside build directory: `cmake -S ../test`\n\n1. Run this command to build the library and unit tests: `make all`\n\n1. The generated test executables will be present in `build/bin/tests` folder.\n\n1. Run `ctest` to execute all tests and view the test run summary.\n\n## CBMC\n\nTo learn more about CBMC and proofs specifically, review the training material\n[here](https://model-checking.github.io/cbmc-training).\n\nThe `test/cbmc/proofs` directory contains CBMC proofs.\n\nIn order to run these proofs you will need to install CBMC and other tools by\nfollowing the instructions\n[here](https://model-checking.github.io/cbmc-training/installation.html).\n\n## Contributing\n\nSee [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on\ncontributing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreertos%2Fcorejson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreertos%2Fcorejson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreertos%2Fcorejson/lists"}