338
seCure develoPment For mobIle APPs
case JSON_ERROR_STATE_MISMATCH:
logError('Underflow or the modes mismatch');
break;
case JSON_ERROR_CTRL_CHAR:
logError('Unexpected control character found');
break;
case JSON_ERROR_SYNTAX:
logError('Syntax error, malformed JSON');
break;
case JSON_ERROR_UTF8:
lo gError('Malformed UTF-8 characters, possibly incorrectly
encoded');
break;
default:
logError('Unknown error');
break;
}
is long switch statement can be shortened considerably as is seen in the next
example.It is listed here in its entirety for reference. Two errors in particular are the
JSON _ ERROR _ UTF8, and the JSON _ ERROR _ SYNTAX messages. ese can
be used to direct logic flow to make corrections. e JSON _ ERROR _ CTRL _
CHAR can be ...