JSONVALID verifies that the supplied buffer contains a valid JSON text.If it does, it returns zero; otherwise it returns the position of the first invalid character.You can use this result to examine the invalid character and/or replace it with a valid character.Keep in mind that the character you are examining is a UTF8 encoded character.And if you choose to replace it, you must replace it with a UTF8 encoded character(s).
Assuming p points to the buffer which contains the data shown in the examples below, then this invocationBytes = jsonvalid(p);
例 1:
{ "NAME" : [0.0,1,-1,2,3.1,-5.12E123,true,false,null] } will find this object to be valid.
例 2:
{ NAME: Dave } will find this object to be invalid at the position where N is because a double quote is expected in this position. i.e. NAME must be enclosed in double quotes.