tristanhimmelman / ObjectMapper

Simple JSON Object mapping written in Swift
MIT License
9.16k stars 1.03k forks source link

Recursive serialization and deserialization #427

Closed nabbestemmia closed 8 years ago

nabbestemmia commented 8 years ago

After reading the documentation I didn't find anything about converting TO and FROM JSON string, an object which has not only "base type" attributes, but nested objects For example: I have a product which has a name a price and a category. when I serialize it into a JSON string, I'd like to have a string like the following: "{\"price\":\"9.99\", \"name\":\"Pac-Man\", \"category\":{\"id\":1,\"name\":\"Videogames\"}}" Is this already possible? If so, how can I obtain this result? Thank you so much for your work!

nabbestemmia commented 8 years ago

Oh, I think I found how to do it. Thanks again!