142
Views
8
Comments
Solved
Can i easily parse this json and filter some elements out of it

Hello, 


from a external api I have this json:

{
  "elapsedMilliseconds": 164,
  "count": 359,
  "artObjects": [
    {
      "links": {
        "self": "https://www.rijksmuseum.nl/api/nl/collection/SK-C-5",
        "web": "https://www.rijksmuseum.nl/nl/collection/SK-C-5"
      },
      "id": "nl-SK-C-5",
      "objectNumber": "SK-C-5",
      "title": "Schutters van wijk II onder leiding van kapitein Frans Banninck Cocq, bekend als de ‘Nachtwacht’",
      "hasImage": true,
      "principalOrFirstMaker": "Rembrandt Harmensz. van Rijn",
      "longTitle": "Schutters van wijk II onder leiding van kapitein Frans Banninck Cocq, bekend als de ‘Nachtwacht’, Rembrandt Harmensz. van Rijn, 1642",
      "showImage": true,
      "permitDownload": true,
      "webImage": {
        "guid": "92253da1-794d-49f4-9e3c-e4c160715f53",
        "offsetPercentageX": 50,
        "offsetPercentageY": 100,
        "width": 2500,
        "height": 2034,
        "url": "https://lh6.ggpht.com/wwx2vAS9DzFmmyeZefPjMtmCNOdjD80gvkXJcylloy40SiZOhdLHVddEZLBHtymHu53TcvqJLYZfZF7M-uvoMmG_wSI=s0"
      },
      "headerImage": {
        "guid": "29a2a516-f1d2-4713-9cbd-7a4458026057",
        "offsetPercentageX": 50,
        "offsetPercentageY": 50,
        "width": 1920,
        "height": 460,
        "url": "https://lh5.ggpht.com/SgH3Qo-vYI8GGm7-b-Qt6lXgsCAIoU2VDRwO5LYSBVNhhbZCetcvc88ZPi518MTy0MHDrna4X4ZC1ymxVJVpzps8gqw=s0"
      },
      "productionPlaces": []
    },


Can I parse this json and take for example only the webImage -> url and the tile out of it for displaying 

2020-08-26 14-54-58
Raghuram kamath
Solution

When you consume a web-service a structure is Automatically created for you. ( Like shown in Image )


Reslut


 I hope I understood your requirement right. If it works for you please mark this as solution

2018-05-31 18-44-19
Ravi Vakkalanka

Hi

DId you try this forge component ?

https://www.outsystems.com/forge/component-overview/413/ardojson

Regards

Ravi


UserImage.jpg
Roelof Wobben

nope, but a nice one to try 


UserImage.jpg
Roelof Wobben

Is there somewhere a example how to parse and filter things out with this component 

2020-08-26 14-54-58
Raghuram kamath

Out systems Inbuilt Json Deserialize  should work right ?

UserImage.jpg
Roelof Wobben

yep, but then I have to find out how to filter some data

2020-08-26 14-54-58
Raghuram kamath

Roelof Wobben wrote:

yep, but then I have to find out how to filter some data

I am guessing you have a Lot of artObjects and you want to pick only Title and WebImages ?

If this is somewhat true then you can write a custom function for filtering these parameters and put them in a new List.

I believe you are aware of "OnAfterResponse" rest api callback ?

you might want to Start Building your custom Filter in this.


Also, I don't think you need to actually filter. I guess you just need to loop over the artObjects from the parsed json and just call the image and title where ever there is a need without any filter

UserImage.jpg
Roelof Wobben

@coder kamath  There will be some 10 images every time that is returned. 

But how do I then call the image and tilte part without any filter

2020-08-26 14-54-58
Raghuram kamath
Solution

When you consume a web-service a structure is Automatically created for you. ( Like shown in Image )


Reslut


 I hope I understood your requirement right. If it works for you please mark this as solution

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.