Json reponse in a table in UI

I am having issues to parsing to displaying Json response in UI. Checked few threads but not very clear.

 Since this is a no/low code platform, I am expecting this should be easily acheiveable. can someone help me to print Json response (I am getting Json document list) in UI?



You need to convert your JSON to a record or list of records of the appropriate structure. Where is the JSON coming from? Is it a fixed format?

You can create a structure for the JSON by going to the data tab, down to "Structures", right clicking and saying "Add Structure From JSON". Then paste in your sample JSON and it will create the structure for you.

Then you can use the JSON Deserialize action to convert your JSON to the structure you created in the above step. From there you connect the resultant list to your table.


I tried but its confusing to create server action and then this de-serialization flow loop etc. Getting some datatype mismatch errors.  Is there any step by step tutorial to have Json response exposed in UI screen? 

Can you give a bit more detail on what you are trying to do. for example, for example where is the JSON coming from? If it is a REST API call then that can deserialize the JSON for you automatically, if you're passing data between forms you can pass structures instead of JSON and the system will again handle serialization etc for you. 

An exact example of what you are trying to do will make it easier for us to give you an example that means something to you.


I have a rest get endpoint, returns list of policies (json ), Need to show in UI.

I am able to call the REST end point,and get response json . after that I am not clear how to go about displaying that in UI. I am not sure if I need to use serialize etc.


My sample Json response :

[
  {
    "_id": "5bac855d933c16126cc2bdcc",
    "policyType": "Car",
    "startDate": "2017-04-05T09:00:00Z",
    "endDate": "2018-05-15T09:00:00Z",
    "premiumAmount": 3000,
    "coverageAmount": 2000,
    "policyHolderID": "5ba0b1b4a54afd7feefc246b",
    "status": "active",
    "propLocation": "London",
     "zipcode": "30019"
  },
  {
    "_id": "5ba0b1b6a54afd7feefc2474",
    "policyType": "Home",
    "startDate": "2017-12-17T09:00:00Z",
    "endDate": "2018-05-05T09:00:00Z",
    "premiumAmount": 4400,
    "coverageAmount": 2900,
    "policyHolderID": "5ba0b1b4a54afd7feefc246b",
    "status": "active",
    "autoMake": "Chevrolet",
    "autoModel": "Tahoe",
    "autoYear": 2014,
    "propLocation": "abcd",
    "vehicleNumber": "GEORGIAABC123",
    "zipcode": "30018"
  }
]


Need to show this list of policies in a table form.



Solution

Ok I suspected it would be something like that. First thing you need to do is define the REST consumer correctly. When you setup the REST action you have an option to either call the REST endpoint as a test or to past the JSON in. Doing either will define the REST endpoint and all the structures it needs. After that you just call the REST and based on the above JSON it will return a List of records all ready for you to use, no manual deserialization needed.

Now all you need to do is create a table on your webscreen, set the returned list as it's source, create the columns and put Expressions in each connected to the appropriate fields from the list. Unfortunately it isn't just a drag and drop like it would be if it was a data entity but it also isn't that hard. I suggest having a look at the basic web courses if you need help creating a table on a webscreen as it will go through a lot more in a better way than I can explain in a post.

https://www.outsystems.com/learn/paths/2/becoming-a-web-developer/


Solution

Thanks for proving some direction. any specific link to set table source as list? I need to dig through all tutorials?

Thanks a lot, I got some output printed. Need to spend some time understanding how these control works.