Question

Map Json response to Page in Activity

Received Json response as below and tried using tools.getStepPage().adoptJSONObject(tools.getStepPage().getString("pyResponseMessage"));

and getting error as follows as we got response in Page for every property. Please let us know to map below mentioned Json response. Above code is working if we are receiving single value for the property.

Response:

{"Field1":{"date":"1960-09-11","s":"T","result":"TEMP"},"Field2":{"date":"1990-09-11","s":"T","result":"1960-04-10"}}

Error: The property Field1 was of mode Page while adoptDictionaryDefinition(ImmutablePropertyInfo, boolean, boolean) was expecting String mode. Details: the mode has been reset to match the property's definition.

Correct Answer
September 11, 2019 - 2:39am

Hi All,

Issue resolved through below function.

 

@(Pega-RULES:Page).pxConvertStringToPage(tools,myStepPage,Param.ResponseMessage,"json")

Comments

Keep up to date on this post and subscribe to comments

September 11, 2019 - 12:28am

Please check the below SA article. Seems like the similar exception 

https://community.pega.com/support/support-articles/wrongmodeexception-while-setting-stringlist-string

September 11, 2019 - 12:35am
Response to Rachit_Agarwal

Hi Rachit,

Thanks for your quick response, Did not help the link you provided, I need to Json response which we received in list form. Could you please help me on this.

September 11, 2019 - 2:39am
Response to LeelaKrishna369

Hi All,

Issue resolved through below function.

 

@(Pega-RULES:Page).pxConvertStringToPage(tools,myStepPage,Param.ResponseMessage,"json")