Moya-ModelMapper icon indicating copy to clipboard operation
Moya-ModelMapper copied to clipboard

How do you convert a mappable object to json?

Open gmann1 opened this issue 7 years ago • 1 comments

I'm able to deserialize just fine, but can't seem to figure out how to serialize TO json. Would love some guidance. I'd like to use this json in a POST request body. The examples aren't that clear to me.

Thanks in advance

gmann1 avatar May 09 '18 17:05 gmann1

Hey @gmann1. I'm afraid it is not possible to serialize to JSON. https://github.com/lyft/mapper is just a deserializer. You would have to do it by hand or use Encodable/Decodable (thus this library wouldn't make sense then, as Moya has an extension to Codable).

sunshinejr avatar May 10 '18 08:05 sunshinejr