bignerdranch / Freddy

A reusable framework for parsing JSON in Swift.
MIT License
1.09k stars 119 forks source link

Convert JSON back to original object #217

Closed okla closed 8 years ago

okla commented 8 years ago
let array = [1, 2, 3]
let json = array.toJSON()

How can I get original array from json?

P.S. Sorry for flooding issues. Maybe there's a better place for such dumb questions?

mdmathias commented 8 years ago

You could try:

let array = [1, 2, 3]
let json = array.toJSON()
let arrayAgain = json.decodedArray(type: Int.self)

The above uses Freddy 3.0.0 syntax, which will be released momentarily.