java.lang.NullPointerException- TextToBinaryData(OutSystems2JSON(ToObject(

java.lang.NullPointerException- TextToBinaryData(OutSystems2JSON(ToObject(

  

hi there, 

i am using this function

TextToBinaryData(OutSystems2JSON(ToObject(ResponseData),DateFormat:),Encoding:)

and the ResponseData has  values, but it raises java.lang.NullPointerException. If I change to OutSystems2JSON(ToObject(ResponseData),DateFormat:) to be  just 'abc', it works....

What's the cause?

thank you

I found the ResponseData has value and the ToObject is working. But, when i supply the object result to the OutSystems2JSON, it raised that error.

Hi there, 

Just to confirm,

Isn't  this function

SyntaxEditor Code Snippet

OutSystems2JSON

performing the same functionality with Outsystems widget Serialize?

For my big json data, the first one returns java null exception, but the second one success gracefully. 

regards,



Hi Box,

I don't know the OutSystems2JSON function, in what Module does it reside?

hi Hack, here u are...

Solution

Ok, then you should indeed use the Serialize Statement. ArdoJSON was needed before Platform 10, but since P10 serialization is built in. If I have to guess, ArdoJSON can only work with Record Lists, not with simple Lists, which causes the error.

Solution

In my case - i use the same json with different data received from a web service, it only works for some json data, but not the json data that causes the exception.

regards,

Ok, in that case it's probably just a bug in the Java implementation of ArdoJSON. But like I said, no need to use that if you're on P10 or higher.

I find the error can be caused by there is an arrays with mixed data type that has null json values, like: [0,null,..]


regards,

Thanks for the feedback.