Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

convert json to json string ios swift

func jsonToString(json: AnyObject){
        do {
          let data1 =  try NSJSONSerialization.dataWithJSONObject(json, options: NSJSONWritingOptions.PrettyPrinted) // first of all convert json to the data
            let convertedString = String(data: data1, encoding: NSUTF8StringEncoding) // the data will be converted to the string
            print(convertedString) // <-- here is ur string  

        } catch let myJSONError {
            print(myJSONError)
        }

    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #json #json #string #ios #swift
ADD COMMENT
Topic
Name
7+1 =