John Doe
John Doe

Reputation: 2491

How to convert BOOL to JSON with NSJSONSerialization?

How do I add a BOOL to NSMutableDictionary so that I get true when serialized as JSON?

I cannot use NSValue, which is a valid object in the dictionary, but for NSJSONSerialization, NSValue is not working.

Upvotes: 0

Views: 95

Answers (1)

Gereon
Gereon

Reputation: 17844

Use NSNumber:

@{ 
   @"foo": @YES
}

Upvotes: 1

Related Questions