Cjson update

This commit is contained in:
Imbus 2025-08-12 03:24:56 +02:00
parent 88146af0ad
commit 4056473705
2 changed files with 15 additions and 2 deletions

View file

@ -1,17 +0,0 @@
#include <cjson/cJSON.h>
#include <stdio.h>
char *build_set_level_command(int level) {
cJSON *root = cJSON_CreateObject();
cJSON_AddStringToObject(root, "cmd", "set_level");
cJSON_AddNumberToObject(root, "level", level);
char *message = cJSON_PrintUnformatted(root);
cJSON_Delete(root);
return message; // Remember to free this when done!
}
int main(void) {
printf("%s\n", build_set_level_command(10));
return 0;
}