JSON

json_Error()

Read the error from the last JSON encode or decode

Syntax

Signature
json_Error() --> cMessage

Return value

The diagnostic message, or an empty string after a successful JSON operation.

Description

Each call to json_Encode() or json_Decode() that processes a value starts with an empty diagnostic. Read the result of json_Error() before the next encode or decode. A wrong argument type passed to json_Decode() raises a runtime error.

Example

json_Error.prg
PROCEDURE Main()

   LOCAL xValue := json_Decode( '{ "a": 1, }' )

   IF xValue == NIL
      QOut( json_Error() )
   ENDIF

RETURN

See also