#include <stdio.h>
#include "jsonsfp_mini.h"
void errorCallback(JSONSFP_ErrorCode errorCode, const char* errorMessage) {
printf("Error: code %d, message: %s
", errorCode, errorMessage);
}
int main() {
const char* jsonString = "{\"name\":\"John\", \"age\":30, \"city\":\"New York\"}";
JSONSFP_Config config;
config.memoryMode = 0;
config.parseNumbersAsStrings = 0;
config.parseNullableFields = 0;
config.parseStringsInPlace = 0;
config.errorNotify = 1;
config.errorCallback = &errorCallback;
config.errorPrintToConsole = 1;
JSONSFP_Context* ctx = JSONSFP_CreateContext(&config);
JSONSFP_Result result = JSONSFP_Parse(ctx, jsonString);
if (result == JSONSFP_OK) {
// ...
} else {
printf("JSON parsing failed.
");
}
JSONSFP_DestroyContext(ctx);
return 0;
}