json-glib 1.0: Parse error: invalid string constant "b", expected valid string constant
Hello, I'm trying to parse my JSON and it seems to get stuck on numbers. I intended to take care of that later so I have replaced my number with a string that says --
. Unfortunately, json-glib also has issues with that. The error->message
says
<data>:1:18: Parse error: invalid string constant "--", expected valid string constant
Here is a minimal example demonstrating the behavior:
const char* json_test = "{\"a\": \"b\"}";
JsonParser *jsonParser = NULL;
GError *error = NULL;
jsonParser = json_parser_new ();
if(json_test != NULL) {
if(strlen(json_test) > 7) {
json_parser_load_from_data(jsonParser, json_test, strlen(json_test+1), &error);
JsonNode *root;
root = json_parser_get_root (jsonParser);
//error->message = <data>:1:18: Parse error: invalid string constant "b", expected valid string constant
Where am I going wrong?
EDIT: Might add that I am writing a Native Tizen Wearable Application. Tizen includes the version 1.0 of json-glib.