Mapping multiple inner JSON collections

14 views
Skip to first unread message

Gil Perry

unread,
Jun 3, 2021, 4:27:26 AM6/3/21
to Smooks Users
Hi. I understand when processing JSON, you can specify the name of the elementName.

However, this seems to be applied to any and all nested JSON collections within the main object when the transformation may require specific element names for different sequences. 

Is this achievable in Smooks, something that is being looked into or perhaps a workaround?

Many thanks! :)

Claude Mamo

unread,
Jun 3, 2021, 5:32:31 AM6/3/21
to smook...@googlegroups.com
Hi Gil,

The latest smooks-json-cartridge docs have a mistake which I've corrected now. The attribute name is arrayElementName; not elementName. I'd say you can achieve what you want in a Smooks pipeline and then escape to Java for transforming the names as shown in this comment: https://github.com/smooks/smooks-csv-cartridge/issues/43#issuecomment-825807741. You could also perhaps delegate transformation to another library more suited for this task rather than writing the transformation code yourself. Readers like json:reader are usually designed for digestion rather than transformation but you can always extend the reader.

Claude

--
You received this message because you are subscribed to the Google Groups "Smooks Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smooks-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/483e0194-5bf5-488a-b15d-7d019551c654n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages