Have a look at the JSONFlattener transformer.
That one is meant for these cases.
Hope this helps.
HI thank you for your response. when i try to expose 'clientRefId" i get a <missing> value. am i missing something here?
HI thank you for your response. when i try to expose 'clientRefId" i get a <missing> value. am i missing something here?
Try exposing Out_clientRefId as that will be the new attribute name, since you ask to prefix the attribute.
Try exposing Out_clientRefId as that will be the new attribute name, since you ask to prefix the attribute.
HI, i have tried that and still the attribute is coming out empty.
Thank you
Connect an inspector to the outputport and analyze the result there for clues in the FME Data Inspector.
If you have one outputfeature with multiple id values in a list:
You probably need to fragment it first, to split the one block of json in several features. Then flatten the attributes:
Added sample workspace template (2020): sample_workbench.fmwt
HI thank you for your response. when i try to expose 'clientRefId" i get a <missing> value. am i missing something here?
You probably need to fragment it first, to split the one block of json in several features, then flatten the attributes. Connect an inspector to the outputport and analyze the result there for clues.
Connect an inspector to the outputport and analyze the result there for clues in the FME Data Inspector.
If you have one outputfeature with multiple id values in a list:
You probably need to fragment it first, to split the one block of json in several features. Then flatten the attributes:
Added sample workspace template (2020): sample_workbench.fmwt
Thank you nielsgerrits , i followed your example and many others today and i am still not able to break down the json. i am starting to wonder if this json (from another company data portal) is either corrupt or unusable. is it at all possible to send the json to you to look at? i am new to json so i am feeling somewhat lost.
Thank you nielsgerrits , i followed your example and many others today and i am still not able to break down the json. i am starting to wonder if this json (from another company data portal) is either corrupt or unusable. is it at all possible to send the json to you to look at? i am new to json so i am feeling somewhat lost.
Sure, send it and I'll have a look.
Thank you nielsgerrits , i followed your example and many others today and i am still not able to break down the json. i am starting to wonder if this json (from another company data portal) is either corrupt or unusable. is it at all possible to send the json to you to look at? i am new to json so i am feeling somewhat lost.
Definitely inspector is a good option here to see how the data looks after the JSONFlattner. You can also try turning on "Recursively Flatten Objects" to see if that helps. JSON is annoying at first but gets easier to work with.
See if you can see anything in the Feature Information Window that realstes to ClientRefId. (it might have a "." Character before it)
If the JSON was corrupt or invalid the the JSONFlattener would reject the data.
Definitely inspector is a good option here to see how the data looks after the JSONFlattner. You can also try turning on "Recursively Flatten Objects" to see if that helps. JSON is annoying at first but gets easier to work with.
See if you can see anything in the Feature Information Window that realstes to ClientRefId. (it might have a "." Character before it)
If the JSON was corrupt or invalid the the JSONFlattener would reject the data.
I think parsing json is just difficult because there are endless combinations possible (data / objects / arrays) , so you really need to understand what you need and what the structure of the file is. When you only are looking for a certain value (succes is true or false) its plain easy. But when you need to read and process related structures it can be hard.
What helps for me is babysteps (this is almost always the solution when I get lost) instead of trying to do it all in once.
But the big help with JSON for me is to use a FeatureReader, point it to a file and being able to browse through the structure and having the paths generated.
I think parsing json is just difficult because there are endless combinations possible (data / objects / arrays) , so you really need to understand what you need and what the structure of the file is. When you only are looking for a certain value (succes is true or false) its plain easy. But when you need to read and process related structures it can be hard.
What helps for me is babysteps (this is almost always the solution when I get lost) instead of trying to do it all in once.
But the big help with JSON for me is to use a FeatureReader, point it to a file and being able to browse through the structure and having the paths generated.
Yes! this for me too! Always saving a response to a text file then using the reader to build the query when building a workspace. Very helpful!
Maybe this brief article will help?
https://knowledge.safe.com/questions/109319/question-of-the-week-flattening-nested-json-attrib.html
But as other folk have mentioned, the JSONFlattener or JSONFragmenter are the transformers you need.