View Full Version : Hasmany relation with a single element

Mohammad Aruri
28 Sep 2011, 10:32 PM
I have a model A that has multiple B's in the retrieved json, so i represented it as a 'hasmany' relation in model's A definition. When B is an array of more than one element (i.e. represented in square brackets in the json [{},{},....] ) the parser works fine. But when it is a single element (i.e. without the square brackets {} ) the parser didn't work, how i can wrap B's representation with the square brackets if it has only one element.