I'm facing an unusual issue that I can't seem to resolve.
Here is an example of a JSON response that I am dealing with.
"values": [
{
"time": "2014-02-26T09:01:00+01:00",
"data": [ "A", "B" ]
},
// additional objects here..
]
Based on this data, I have implemented the following xsl transformation.
<xsl:for-each select="values">
{
'time': <xsl:value-of select="time"></xsl:value-of>',
'val1': '<xsl:value-of select="data[1]"></xsl:value-of>',
'val2': '<xsl:value-of select="data[2]"></xsl:value-of>'
},
</xsl:for-each>
However, when the time transform is included, I encounter an error in Worklight.
"For input string: \"2014-02-26\"",
"The returned InvocationResult must be a valid JSON Object."
Interestingly, if I remove or comment out the time transform, everything functions correctly.
What could be causing this issue? Is there a need for escape characters?