Use index for storing has-many inline
Decode from both array and object
Merge pull request #1065 from Arjeno/has-many-with-index

HasMany toJSON with index