We are trying to return a particular format of JSON from webMethods flow service.
we are just moving our apis to ESB and in order to keep old applications working we need the same json structure that we are having already.
but there is an issue while making response according to our need, can anyone has any guideline that how can we transform our data to a particular json structure?
Can you share your Data Model, you can have some Canonical Data Model in webMethods to ease the integrations within your enterprise.
i am expecting JSON response of the format like this
[
{
“EventID”:63,
“Name”:“Yaz Event”,
“StartDate”:“2018-06-01T00:00:00”,
“EndDate”:“2018-06-30T00:00:00”,
“EmiratesID”:1,
“Sector”:0
},
{
“EventID”:63,
“Name”:“Yaz Event”,
“StartDate”:“2018-06-01T00:00:00”,
“EndDate”:“2018-06-30T00:00:00”,
“EmiratesID”:1,
“Sector”:0
}
]
But from the Flow Service, following type of response i get,
{
“SelectAllEventsOutput”: {
“results”: [
{
“EventID”: 1,
“Name”: “Transport and Airline Exhibition”,
“StartDate”: “2017-07-20 00:00:00.0”,
“EndDate”: “2017-10-19 00:00:00.0”,
“EmiratesID”: 2,
“Sector”: “0”,
“RecruitmentTarget”: 200,
“GoogleMapUrl”: null,
“Details”: “Ajman”,
“SourceOfMarketing”: null,
“IsActive”: false,
“CreatedOn”: “2018-02-06 17:06:23.63”,
“CreatedBy”: 1,
“UpdatedOn”: “2018-04-10 14:14:49.1”,
“UpdatedBy”: 1,
“Latitude”: 25.1932917797,
“Longitude”: 55.2890396118
}…
]
}
i want to remove SelectAllEventsOutput and enclose the response as list items.
i have also attached the Document Structure of my flow Service in attachment
It’s quite simple, create an IS document with the JSON structure (you can use this to convert it to JSON string via the BIS service). Map the result set (results) output of adapter service to the IS document, drop the fields that you do not need.
Thank you for the quick response.
i have done the same.
As i am expecting the List in JSON so i created List of Document as you can see in my previous post.
i have also attached the pipeline screen shot as well.
Whatever i get from Adapter service you can see here, As you can see result is the pipeline output, so when i will publish this to Portal or try to access it will return me JSON that will be starting from result:[{ }] which is not required,
if i drop SelectAllEventsOutput then i will get No Output from the pipeline.
Any suggestions?
And also i can not return an array of Document List which has no name.
You can have JSON Array of Objects like this, if this helps see the screen shot for mapping
{
“events”: [{
“eventId”: “1”,
“Name”: “a”
},
{
“eventId”: “2”,
“Name”: “b”
}]
}
Make sure you map the output of adapter service results set to document reference list. Any questions, you can feel free to text me.