Solved

A little help exposing attributes in a JSON

  • 17 April 2024
  • 2 replies
  • 25 views

Badge +1

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.

icon

Best answer by david_r 17 April 2024, 10:01

View original

2 replies

Userlevel 4

Try something like this:

Result:

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

Badge +1

Thank you david_r that works!

Reply