PDA

View Full Version : [FIXED]Model returning wrong JSON in singular object case!



wizkid
7 Mar 2011, 3:33 PM
In preview release 2 you could not send this JSON and have it deserialized by the Model



{
"LoginUserId":"brian@test.com",
"FirstName":"Bob",
"LastName":"Dole"
}


Now in Preview release 4 I can do a .load and it will properly take the above JSON from my server.
That's a good thing!

But now if I do a .save() on the model this is what is sent to my server:



{"records":[{"LoginUserId":"brian@test.com","FirstName":"Bob","LastName":"Dole"}]}


I would of assumed it to not return it in a array at the very minimum. Although I would
of expected it to look like the JSON I sent it in the first place!

I don't know if this is a bug or not. But for me I have to handle my fetch serialization
differently than my save deserialization on the server. That just seems wrong because the
data structure should of been preserved in the round trip from server to client, client to server.

This seems like a bug to me.

Thanks!

evant
10 Mar 2011, 1:17 AM
The writer has been updated to be more flexible, will be in the next release.