An object that converts between JSON and the equivalent Foundation objects.
- iOS 5.0+
- macOS 10.7+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
You use the
NSJSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON.
A Foundation object that may be converted to JSON must have the following properties:
All dictionary keys are instances of
Numbers are not NaN or infinity.
Other rules may apply. Calling
is or attempting a conversion are the definitive ways to tell if a given object can be converted to JSON data.