JSONPayload faults on plain old number or plain old string

In testing we found that using an ExtractVariables policy with JSONPayload raises a fault when trying to parse:

 

"Foo"

 

or

 

5

 

The error shown is:

 

error              ExtractVariables EV-JsonString: Json path parsing failed for for flow variables jsonString
error.class        com.apigee.kernel.exceptions.spi.UncheckedException
error.cause        Failed to execute the ExtractVariables: EV-JsonString
error.cause.cause  Expecting { or [ at line 1

 

There seems to be some debate around whether plain old strings or plain old numbers are indeed valid JSON.  The syntax is supported in Chrome, Node, Newtonsoft (C#), and in the Rhino Javascript engine used with a JavascriptCallout policy. I did not test how these would parse using libraries within a JavaCallout or PythonScript policy.  I was able to reproduce this in both on-prem and ApigeeX versions.  This is ultimately not an issue and we can work around this specific case.

 

This Edge edge case did peak my curiosity though...  What is the underlying library that is used for parsing JSON with JSONPayload?

0 1 133
1 REPLY 1

What is the underlying library that is used for parsing JSON with JSONPayload?

We don't disclose that, it's not part of the documented and supported interface for Apigee.