Fix serialization of hasOne and hasMany relationships for different JSON naming scenario.