The official cJSON docker image.
Maintained by: openEuler CloudNative SIG.
Where to get help: openEuler CloudNative SIG, openEuler.
Current cJSON docker images are built on the openEuler. This repository is free to use and exempted from per-user rate limits.
cJSON aims to be the dumbest possible parser that you can get your job done with. It's a single file of C, and a single header file.
The tag of each cjson docker image is consist of the version of cjson and the version of basic image. The details are as follows
| Tag | Currently | Architectures |
|---|---|---|
| 1.7.19-oe2403sp4 | cjson 1.7.19 on openEuler 24.03-LTS-SP4 | amd64, arm64 |
| 1.7.19-oe2403sp3 | cjson 1.7.19 on openEuler 24.03-LTS-SP3 | amd64, arm64 |
| 1.7.18-oe2403sp1 | cJSON 1.7.18 on openEuler 24.03-LTS-SP1 | amd64, arm64 |
In this usage, users can select the corresponding {Tag} based on their requirements.
Pull the openeuler/cjson image from docker
docker pull openeuler/cjson:{Tag}
Run with an interactive shell
You can start the container with an interactive shell to run your own code using cJSON.
docker run -it --rm openeuler/cjson:{Tag} bash
Sample code
test.c
#include <stdio.h>
#include <stdlib.h>
#include <cjson/cJSON.h>
int main() {
cJSON *root = cJSON_CreateObject();
cJSON_AddStringToObject(root, "name", "Alice");
cJSON_AddNumberToObject(root, "age", 25);
char *json_str = cJSON_Print(root);
printf("Generated JSON:\n%s\n", json_str);
cJSON *parsed = cJSON_Parse(json_str);
cJSON *name = cJSON_GetObjectItem(parsed, "name");
printf("Parsed name: %s\n", name->valuestring);
cJSON_Delete(root);
cJSON_Delete(parsed);
free(json_str);
return 0;
}
Compilation Instructions
Compile the program using GCC:
gcc test.c -lcjson -o test_json
Running the Program
./test_json
Expected Output:
Generated JSON:
{
"name": "Alice",
"age": 25
}
Parsed name: Alice
If you have any questions or want to use some special features, please submit an issue or a pull request on openeuler-docker-images.
Content type
Image
Digest
sha256:80be570e5…
Size
193.9 MB
Last updated
3 months ago
docker pull openeuler/cjsonPulls:
16
Last week