Rails flexirest model is deconstructing array of 2 objects into an object with 2 properties with an array each

Viewed 21

I have this weird error where my flexirest model is being called with

{
  "people" => [
    {"name" => "Jane", "age" => 33},
    {"name" => "John", "age" => 36}
  ]
}

When the receiving end (node) gets

{
  "people": {
    "name": ["Jane", "John"],
    "age": [33, 36]
  }
}

I know it's not the receiving service, because a postman request shows the correct structure. Any idea what might have gone wrong?

Thanks!

1 Answers

Showed this to an experienced senior engineer, he said it was most likely flexirest sending the data as form data.

Added request_body_type :json and now it's sending the correct information.

Related