I am currently trying to make a Jansson JSON object and then "stringify" it for some other function I use that needs JSON.
According to addr2line, line 6 (*setErr = json_string_set(...)) is causing a data abort exception.
What is the correct way to create a JSON object from scratch?
Code:
#include <jansson.h>
#include <3ds.h>
int myFunction(int* setErr) {
json_t* req = json_object();
*setErr = json_string_set(json_object_get(req, "email"), "foo");
if(setErr != 0){
return -1;
}
*setErr = json_string_set(json_object_get(req, "password"), "bar");
if(setErr != 0){
return -1;
}
someOtherFuncion(json_dumps(req, JSON_COMPACT));
return 0;
}
According to addr2line, line 6 (*setErr = json_string_set(...)) is causing a data abort exception.
What is the correct way to create a JSON object from scratch?