Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

#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

OriginalPostID-168747

OriginalPostID-168747

  Discussion posts and replies are publicly visible

Parents
  • 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:

    todatasubset(
        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:

    pv!dataPayload.data.DESC
    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)

    index(
        index(
            pv!dataPayload,
            "data",
            null
        ),
        "STATUS",
        null
    )
    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.

Reply
  • 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:

    todatasubset(
        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:

    pv!dataPayload.data.DESC
    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)

    index(
        index(
            pv!dataPayload,
            "data",
            null
        ),
        "STATUS",
        null
    )
    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.

Children
No Data