# How to handle root key in JSON API responses (rom-http)

**URL:** https://discourse.rom-rb.org/t/how-to-handle-root-key-in-json-api-responses-rom-http/584
**Category:** Issues
**Created:** [January 19, 2023, 10:22am UTC](https://discourse.rom-rb.org/t/how-to-handle-root-key-in-json-api-responses-rom-http/584 "2023-01-19T10:22:48Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mbajur](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/mbajur/32/284_2.png) [@mbajur](https://discourse.rom-rb.org/u/mbajur)
#### Post date: [January 19, 2023, 10:22am UTC](https://discourse.rom-rb.org/t/how-to-handle-root-key-in-json-api-responses-rom-http/584/1 "2023-01-19T10:22:48Z")

</div>

Hello!

I’m writing a custom HTTP adapter for one of the APIs i have to consume and all the list resources are returning their data under the parent node. So, for a list of products, the response would be:

```auto
{
  "products": [
    { "id": 1 },
    { "id": 2 },
  ]
}

```

While, from what i understand, a following resource definition expects the results to not be nested:

```auto
module Presta
  module Resources
    class Products < ROM::Relation[:http]
      schema(:products) do
        attribute :id, Types::Integer
      end
    end
  end
end

# => :id is missing in Hash input (Dry::Types::MissingKeyError)

```

What would be the easiest way of telling rom-http to use the nested dataset instead of operating on the parent node? Thanks in advance for any clues, i tried googling for that but was not able to find anything helpful.
