swift - Indexing into JSON object -
i have json object in shape of:
let allsnippets = [<metdocument key: <collection: snippets, id: xnmjqh5n3hbomnatk>, fields: { text = "first snippet"; }>, <metdocument key: <collection: snippets, id: kvqwnwfyto5ixxsni>, fields: { text = "second snippet"; }>]
how can index , example text "second snippet" fields ?
i tried this:
let json = json(allsnippets) if let text = json[1]["text"].string{ print(text) }
but did not work.
Comments
Post a Comment