json-transformer

Force an Array Object Structure

universalBeginner

About this Snippet

Make sure data is passed downstream as an array (even if it is one item). Useful when you have an API that passes multiple items in an array, but single items as just an object. This makes it hard to handle that data downstream because you have to build logic for either option - unless you make the data consistent (as an array)

See it in action

CleanShot 2023-07-21 at 17.06.23@2x