Hi guys,
Have a problem:
initial data:
[ { "field1": "Value1", "field2": "Value2 }, { "field1": "Value1", "field2": "Value2 }, .....
Mapping such json - don't have any problem using: Response.map(to: [Custom].self)
But if I have empty root array [ ] - we got "Failed to map data to JSON." But there is no Failing to map. It is just empty array. Is not better to return empty array instead of error? Or maybe I do something wrong and there is another way?
Thanks.
Hi guys,
Have a problem:
initial data:
[ { "field1": "Value1", "field2": "Value2 }, { "field1": "Value1", "field2": "Value2 }, .....Mapping such json - don't have any problem using: Response.map(to: [Custom].self)
But if I have empty root array
[ ]- we got "Failed to map data to JSON." But there is no Failing to map. It is just empty array. Is not better to return empty array instead of error? Or maybe I do something wrong and there is another way?Thanks.