Phoenix seems to have an unconventional way of serializing JSON (it's new to me anyway). For example, let's say I have a table with two columns - id, and name. In nearly every other web framework the response to the show endpoint would return JSON that looks like this:
{
"id": 1,
"name": "foo"
}
Using the Phoenix generators the response looks like this:
{
"data":
{
"id": 1,
"name": "foo"
}
}
I'm seeing similar issues with POSTs, I need to post {"company": { "name": "foo" } } instead of { "name": "foo" }.
I have two questions:
- Is there an advantage to serializing JSON this way that I'm unaware of?
- Is there a way to handle JSON serialization in the "normal" way as described above?