Can Anyone help me out in decoding this JSON
Code Block { "name": "Foo", "age": 34, "activities": [ { "test1": "testing", "type": "xyz", "three": { "label1": "Testing1", "content": [ { "mark1": "markTest1", "mark2": "markTest2" } ] } }, { "test2": "Running", "type": "zzzz", "three": [ { "label2": "Testing1" }, { "label2": "Testing1" } ] } ] }
You can try it like this:
```
Code Block Swift let demo = """ {"name":"Foo","age":34,"activities":[{"test1":"testing","type":"xyz","three":{"label1":"Testing1","content":[{"mark1":"markTest1","mark2":"markTest2"}]}},{"test2":"Running","type":"zzzz","three":[{"label2":"Testing1"},{"label2":"Testing1"}]}]} """ guard let data = demo.data(using: .utf8) else { return } let decoded = try? JSONDecoder().decode(TopLevel.self, from: data) print(decoded?.name)
```