Skip to main content
Solved

A little help exposing attributes in a JSON

  • April 17, 2024
  • 2 replies
  • 369 views

j.m-visma
Contributor
Forum|alt.badge.img+5

I am making a call to an API and getting a JSON in return. With the JSONFragmenter and it's flattening options, I can expose most of the attributes in the JSON into FME attributes, but I am getting stuck on a particular structure. Sometimes there's a little table within a single attribute in the JSON like so:

 

"related_objects": [
                    {
                        "relation_name": "verbinding",
                        "relation_id": 1,
                        "objects": [
                            "randomid1",
                            "randomid2",
                            "randomid3"
                        ]
                    }
                ]

 

This indicates objects that are related in a particular way to the object in my query. I would like to generate a list of all of the related objects (randomid1, randomid2 etc.). I want to use that  list in my FME flow. The number of related objects might be one, or a hundred, in this case it's three.

How do I make FME turn that little array of three related objects into a list?

 

I include a slightly edited version of the whole API return.

Best answer by david_r

Try something like this:

Result:

You may have to modify your JSON query above so that it matches your exact JSON document.

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

david_r
Celebrity
  • Best Answer
  • April 17, 2024

Try something like this:

Result:

You may have to modify your JSON query above so that it matches your exact JSON document.


j.m-visma
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • April 17, 2024

Thank you david_r that works!