store JSON result into a Json Array

326 views
Skip to first unread message

con...@ecotronicbr.com

unread,
Oct 15, 2014, 12:58:25 AM10/15/14
to suppor...@runmyprocess.com
Hello,

I'm using a CAPI that returns json object and I'ma trying to store this ins a json array. I'm using P_to_array(json_object, key) function.

The description of P_status is:


2014-10-15T04:49:24+0000 - Task "Busca dados SIGE" (id: 1[0] - status: ABORTED): Error while processing {P_to_array(P_result.value,"RG")}
java.lang.ClassCastException: org.runmyprocess.json.JSONArray cannot be cast to org.runmyprocess.json.JSONObject


Can help me?

Murali

unread,
Oct 15, 2014, 3:38:05 AM10/15/14
to suppor...@runmyprocess.com, con...@ecotronicbr.com
Hi,

As per the exception message what i understood was, the input P_result.value is JSONArray and the function P_to_array is expecting the JSONObject.
I believe you must use P_result instead P_result.value, because the CAPI return the JSONObject as per that you mentioned.

A sample code that could work for your scenario is :

<#assign json_object = {"RG":[{"title":"John"},{"title":"Mathew"}]}> ${P_to_array(json_object,"RG")}

Refer to below code examples for additional guidelines.


Please feel free to revert for any additional help.

Regards,
Murali
Reply all
Reply to author
Forward
0 new messages