Right now I'm trying to remove the root name from my json response.
I'm getting this:
{
"list": {
"accounts": [
{
"id": 4,
"name": "ACCOUNT",
"country_id": 1
}
]
}
}
When I'm trying to get this:
{
"list": [
{
"id": 3,
"name": "VONS",
"country_id": 1
}
]
}
This is my controller:
render json: { list: ActiveModelSerializers::SerializableResource.new(@accounts.order(:account_name), each_serializer: AccountSerializer)}, status: :created
I'm using Rails 5 with AMS 10.0
Thanks
pass in adapter: :attributes to remove the root. Also, it would be helpful if you included the exact version.
Most helpful comment
pass in
adapter: :attributesto remove the root. Also, it would be helpful if you included the exact version.