How to set custom field to JSON object

I’m trying the input bundle of the receiving module for the “foo” field to look like this:

..
"foo": [
  {
    "bar": "baz"
  }
]
..