swift2 - Show JSON data in text View in Swift -


i getting response server

[{      "images":[{        "title_de":"sdfs",        "title_it":"dsdfs",        "title_fr":"dfsf",        "approved":"true",        "title_ru":"sdsf",        "title_ko":"sdfs",        "title_jp":"sfsdf",        "title_es":"sdfs",        "title_pt":"dfs",        "folder_id":29,        "title_en":"title image",        "title_hi":"sdfss",        "image_used_count":"0",        "updatedtime":"1470641760",        "folder_empty":"false",        "id":115,        "is_folder":"false"    },     {        "title_de":"tests ashdod",        "title_it":"test cv",        "title_fr":"tests asgard",        "approved":"true",        "title_ru":"testvxcv",        "title_ko":"testvcxv",        "title_jp":"tests cv",        "title_es":"testvcxv",        "title_pt":"test cox",        "folder_id":19,        "title_en":"testsds",        "title_hi":"testvxcv",        "image_used_count":"0",        "updatedtime":"1470401264",        "folder_empty":"false",        "id":99,        "is_folder":"false"    }] }] 

now want show response on text view , here code

self.tv_response.text = string(format:"%@", json as! string ) 

but getting error

could not cast value of type '__nscfarray' (0x1025a8ae0) 'nsstring' (0x101c13b20).

i try

self.tv_response.text = nsstring(format:"%@", json as! string ) 

but not working please me ...

your response array can not directly convert string.

self.tv_response.text = "\(json as! nsarray)" 

or

self.tv_response.text = "\(json as! [[string: anyobject]])" 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -