[SOLVED] How to send array of child objects through eventbridge input transformation?


This Content is from Stack Overflow. Question asked by chromebookdev

I’ve come across a strange anomoly with Event Bridge.

I have an incoming message to eventbridge. This comes through with some details, namely an array of ‘items’.
In the interest of message brevity and transferring only the data I want to pass on, I’ve setup a rule to transform it down.

The json of the ‘detail’ of the message looks like this:

{"detail" : 
    {"sale" : 
        {"items" : 
                "product" : "cheese",
                "quantity" : 1
                "product" : "tomato",
                "quantity" : 1

I have tried setting the input transformer to the following but am not getting any success.


(the above are either invalid when setting the input transformer, or they simply don’t trigger the rule to send anything on)

However if I use:


It happily returns the number 1 for me.

It’s almost like EventBridge items with children, you can’t select multiples.
Or items with multiple levels, you need to select the very lowest level to get data the data out.

AWS doco only ever points to examples with lowest level json objects, or singular hard-referenced array items.

Has anyone got this working with child items or arrays?


The correct syntax was:


Which works when sending to a lambda function which is my required use case.
However I haven’t been able to confirm it working for cloudwatch or sns targets.

This Question was asked in StackOverflow by chromebookdev and Answered by chromebookdev It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?