toJSON support for nested models