JSONSerialization
An object that converts between JSON and the equivalent Foundation objects.
Declaration
class JSONSerializationOverview
You use the JSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON.
To convert a Foundation object to JSON, the object must have the following properties:
The top level object is an NSArray or NSDictionary, unless you set the fragmentsAllowed option.
All objects are instances of NSString, NSNumber, NSArray, NSDictionary, or NSNull.
All dictionary keys are instances of NSString.
Numbers are neither
NaNnor infinity.
Other rules may apply. Calling isValidJSONObject(_:) or attempting a conversion are the definitive ways to tell if the JSONSerialization class can convert given object to JSON data.