Made toJSON of Rect consistent with its constructor