Skip to content

Can't parse root with parse_root_in_json #331

@cakejelly

Description

@cakejelly

I'm trying to consume an API that returns data in the format below but I can't seem to get parse_root_in_json to parse it properly. Any ideas why this isn't returning anything?

// GET /users

{
  "data": [{"id": 1234, first_name: "user1"}, {"id": 1234, first_name: "user1"}, ...]
}

My model:

class User
   include Her::Model
   parse_root_in_json :data
end

I've also tried parse_root_in_json true, format: :active_model_serializers and root_element :data but nothing seems to work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions