Convert JSON to CDT

Hello everyone, I have a process model that is using a custom smart service to perform web service calls. The below json is the response I'm getting. I need to store these results into a database table. Please provide me some guidance on what would be the best approach on parsing this json string into a CDT.

{
  "id":"123",
  "status": "working",
  "reports":[
                 {
                     "name": "report1",
                     "status": "complete",
                     "_links": [
                                 {
                                     "type": "csv",
                                     "href": "http://..../report1.csv"
                                  }
                     ]
                  },
                  {
                     "name": "report2",
                     "status": "errored",
                     "reason": "Something horrible occurred..."
                     "_links": [
                     ]
                  },
                  {
                      "name": "report3",
                       "status": "working",
                       "_links": [
                       ]
                   },
                   {
                       "name": "report4",
                       "status": "pending",
                       "_links": [
                       ]
                    },
  ]
}

Thank you!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    Hi i believe performing parsing operation using Appian will be quite better, where you can create an Expression rule and by using a!fromJson() and custom manipulation you can return Dictionary or CDT and create a CDT for the Same Structure as your response Dictionary and Cast your Dictionary Data into Array of CDT.

    I believe once you have CDT ready, you can play around it.

    I know using Nested CDT is never a good idea and recommended but as per Appian standard you can go till 1 level of Nested CDT without violating the Appian Standard, and this makes your JOB easy.

    But if you want to go for separate CDT's, then you need to segregate the Dictionary data and then accordingly map them to their respective CDT's which might make your job a bit complex.

    Hope this will give you high level understanding, about which approach fits for your requirement
Reply
  • 0
    Certified Lead Developer
    Hi i believe performing parsing operation using Appian will be quite better, where you can create an Expression rule and by using a!fromJson() and custom manipulation you can return Dictionary or CDT and create a CDT for the Same Structure as your response Dictionary and Cast your Dictionary Data into Array of CDT.

    I believe once you have CDT ready, you can play around it.

    I know using Nested CDT is never a good idea and recommended but as per Appian standard you can go till 1 level of Nested CDT without violating the Appian Standard, and this makes your JOB easy.

    But if you want to go for separate CDT's, then you need to segregate the Dictionary data and then accordingly map them to their respective CDT's which might make your job a bit complex.

    Hope this will give you high level understanding, about which approach fits for your requirement
Children
No Data