Skip to main content
Solved

Use ODATA Reader to read nested complex types (arrays)

  • June 28, 2024
  • 2 replies
  • 165 views

_fabian_
Contributor
Forum|alt.badge.img+5

I’m trying to retrieve data from a nested JSON response of an ODATA Feed.

For testing, I try to access the “Emails” property of this ODATA example service: https://services.odata.org/V4/(S(hg4u5ox0x0r2rjva5qwwra05))/TripPinServiceRW/People

The JSON structure is as follows:

{
"@odata.id": "http://services.odata.org/V4/(S(hg4u5ox0x0r2rjva5qwwra05))/TripPinServiceRW/People('russellwhyte')",
"@odata.etag": "W/\"08DC9753B5381A6D\"",
"@odata.editLink": "http://services.odata.org/V4/(S(hg4u5ox0x0r2rjva5qwwra05))/TripPinServiceRW/People('russellwhyte')",
"UserName": "russellwhyte",
"FirstName": "Russell",
"LastName": "Whyte",
"Emails": [
"Russell@example.com",
"Russell@contoso.com"
],
"AddressInfo": [
{
"Address": "187 Suffolk Ln.",
"City": {
"CountryRegion": "United States",
"Name": "Boise",
"Region": "ID"
}
}
],
"Gender": "Male",
"Concurrency": 638551632958200400
}

 

The “Emails” property is a complex type property, which should be able to be read by the readers documentation.

Each entry represents a structured record with a key that has a list of properties of primitive or complex types.

 

But when using the ODATA reader, only the simple properties get returned:


Is there any possibility to read nested properties (JSON objects/arrays) or do I have to resort to using a HTTPCaller?

Best answer by debbiatsafe

Hello @_fabian_ 

It appears the OData reader does not currently support reading Complex Type properties within a Complex Type. FMEENGINE-40129 tracks improving support for OData version 4, which should add support for reading nested complex type properties.

You may need to read the OData feed with an HTTPCaller and parse the JSON response with JSON transformers. Attached is a simple workspace demonstrating this approach, and I hope it helps.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

debbiatsafe
Safer
Forum|alt.badge.img+21
  • Safer
  • Best Answer
  • June 28, 2024

Hello @_fabian_ 

It appears the OData reader does not currently support reading Complex Type properties within a Complex Type. FMEENGINE-40129 tracks improving support for OData version 4, which should add support for reading nested complex type properties.

You may need to read the OData feed with an HTTPCaller and parse the JSON response with JSON transformers. Attached is a simple workspace demonstrating this approach, and I hope it helps.


_fabian_
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • July 1, 2024

Hello @_fabian_ 

It appears the OData reader does not currently support reading Complex Type properties within a Complex Type. FMEENGINE-40129 tracks improving support for OData version 4, which should add support for reading nested complex type properties.

You may need to read the OData feed with an HTTPCaller and parse the JSON response with JSON transformers. Attached is a simple workspace demonstrating this approach, and I hope it helps.

That’s a pity 😔 Looking forward to the improved reader! Thanks for the quick reply and clarifying the current limitations.