Convert Array into Json String

Here are some useful utility functions/methods that can be used as with Array extension for ease of developer to perform certain critical operations on array with help of single line code.

Call this function with parameter argument as array with type ‘any’. It will return you json string. Json string is used to submit array in web service call as request input parameter in Swift.

let array = [["one" : 1], ["two" : 2], ["three" : 3], ["four" : 4]]let jsonString = convertIntoJSONString(arrayObject: array)
print("jsonString - \(jsonString)")

--

--

iOS Developer, Triple graduated, Passionate, Love workout, blogger

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mr.Javed Multani

iOS Developer, Triple graduated, Passionate, Love workout, blogger