kgabis/parson

Parsing failure.

kmj7811 opened this issue · 1 comments

Dear.

I try to use this parson code for project.
When It parse json string including several string combination.
It meet parsing failure.

This is the sample Json string to parse.

{
"CmdNo":1111,
"CmdTime":"2019-07024",
"Offset":"9:00:00",
"CmdType":"SUB",
Data:
{
"ResultCode":0,
"Services":
[
{"serviceCode":12,
"ServiceName":"AC",
"Status":1,
"ExpireDate":"2020-12-31"
},
{"serviceCode":13,
"ServiceName":"BC",
"Status":1,
"ExpireDate":"2020-12-31"
}
],
"Phone":
[
{
"No":"12345678",
"Type":1
},
{
"No":"12341234",
"Type":2
}
]
}
}

When I run, It meet failure at the step as below

static char * get_quoted_string(const char **string) {
const char *string_start = *string;
size_t string_len = 0;
JSON_Status status = skip_quotes(string); ---> meet failure
if (status != JSONSuccess) {
return NULL;
}
string_len = string - string_start - 2; / length without quotes */
return process_string(string_start + 1, string_len);
}

Do you have a idea ?

How can I parse this kind of Json string..?

Thank you

You JSON is incorrect, it's missing quotes in "Data". See https://codebeautify.org/jsonvalidator/cbdae9f6. Please verify your JSON before submitting issues.