Inherits from NSObject
Declared in MSFKJSONUtils.h
MSFKJSONUtils.m

Overview

Utility methods for working with JSON data.

@ingroup Utilities

Class Methods

isJSONString:equivalentTo:

Tests if two JSON strings are equivalent. This does a deep comparison of the JSON data in the two strings, but ignores any differences in the ordering of keys within a JSON object. For example, { “width”:64, “height”:32 } is considered to be equivalent to { “height”:32, “width”:64 }.

+ (BOOL)isJSONString:(NSString *)actual equivalentTo:(NSString *)expected

Discussion

Tests if two JSON strings are equivalent. This does a deep comparison of the JSON data in the two strings, but ignores any differences in the ordering of keys within a JSON object. For example, { “width”:64, “height”:32 } is considered to be equivalent to { “height”:32, “width”:64 }.

Declared In

MSFKJSONUtils.h

parseJSON:

Parses a JSON string into an object.

+ (id)parseJSON:(NSString *)json

Parameters

json

The JSON string to parse.

Return Value

The root object of the object hierarchy that represents the data (either an NSArray or an NSDictionary), or nil if the parsing failed.

Discussion

Parses a JSON string into an object.

Declared In

MSFKJSONUtils.h

writeJSON:

Writes an object hierarchy of data to a JSON string.

+ (NSString *)writeJSON:(id)object

Parameters

object

The root object of the object hierarchy to encode. This must be either an NSArray or an NSDictionary.

Return Value

An NSString containing the JSON encoding, or nil if the data could not be encoded.

Discussion

Writes an object hierarchy of data to a JSON string.

Declared In

MSFKJSONUtils.h