Skip to main content
Solved

A little help exposing attributes in a JSON


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

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.

View original
Did this help you find an answer to your question?

david_r
Evangelist
  • 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+2
  • Contributor
  • April 17, 2024

Thank you david_r that works!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings