Skip to main content

Hi I have used JsonFragmenter to read a json file and have ended up with a set of attribute values plus a list of values for each feature. I need to write the list to single attributes in a table based on the index. (see attached)

e.g Signalstatus[0] written to field STATUS_0

Signalstatus[1] -> STATUS_1 e.tc.

Any suggestion ?

There is sadly no listFlattener transformer.

 

You can however use the BulkAttributeRenamer with Regular Expression Replace

 

Text to Find: ^Signalstatus{(\\d+)}$

 

String: STATUS_\\1

EDIT: use the exact list name in the data, based on the png it would likely be ^Statuslist\\.Signalstatus{(\\d+)}\\.Status$


Or use a ListRenamer followed by a ListKeyValuePairExtractor (on FME Hub).


There is sadly no listFlattener transformer.

 

You can however use the BulkAttributeRenamer with Regular Expression Replace

 

Text to Find: ^Signalstatus{(\\d+)}$

 

String: STATUS_\\1

EDIT: use the exact list name in the data, based on the png it would likely be ^Statuslist\\.Signalstatus{(\\d+)}\\.Status$

Good suggestion.

 

If you expose the list elements under a prior transformer (right-click on the list name > Expose Elements > Select List Elements), the BulkAttributeRenamer would expose destination attribute names automatically, for what it's worth.

 


Reply