#i have web service call which returns text which contains json format data i ne

#i have web service call which returns text which contains json format data i need to convert into cdt for further processing into process model
/screen to show edit and also updated cdt into database with the webservice call.
#webservice returns text,contains data like=
"DESC": null,
"ERROR": null,
"STATUS": 1,
          "DATA":"[{\\"Test_no\\":\\"00\\",\\"Test_name\\":\\"name test information\\",\\"Test_status\\":1.0,\\"Test_created_date\\":\\"\\\\/Date(1440448162000-0500)\\\\/\\",\\"Test_update_id\\":null,\\"Test_update_date\\":\\"\\\\/Date(1440448162000-0500)\\\\/\\"}]"
i think need to create cdt dynamically for json data.what will be the syntax for that and how to convert that Data part of json into cdt?
if any one doing this work before please provides valueable suggestion and commnets



  Discussion posts and replies are publicly visible

  • Hey, I think I master this already, thank you ChatGPT

  • I think that you might have an easier time converting the resulting data to a dictionary or map using the a!fromjson function.  This will give you an object into which you can reference elements using either dot notation or the index function.

    For example:   Let's say that your payload comes back from an Integration Smart Service call in a process, and you save it into a process variable called pv!result. Appian doesn't have a "Dictionary" type, but you can do something in the Data Outputs of a Script Task such as:

        arrayToPage: a!fromjson(pv!result),
        pagingConfiguration: a!pagingInfo(startIndex:1, batchSize:-1)

    If you save the result of that expression into a new process variable of type "DataSubset" called say, pv!dataPayload,  you will be able to programmatically reference all of the elements using either .dot notation:

    to get at the contents of the "DESC" element.

    Or you could use the index function to retrieve a specific element (which is safer with respect to nulls)

    which essentially says, "extract the 'data' element from pv!dataPayload", then "extract the 'STATUS' element from the results of the previous index call"

    Hope that helps.