tags:

views:

369

answers:

1

Using the json-framework for iPhone (http://code.google.com/p/json-framework/) it's really easy to create json data from a NSDictionary. Like so;

NSString *json_string = [json_parser stringWithObject:dictionary];

This works perfect if I have objects like NSString and so on in my dictionary. But I also need to send integers,bools and floats with json and can not find a way to do this in the same way. Anyone got a solution?

UPDATE:

I found out that I can wrap integers to NSNumber. But how can I use bools?

A: 

I believe that json-framework maps from JSON bools and numbers to NSDecimalNumber. In the case of bools, the NSDecimalNumber should be init'd with initWithBool:. Give that a try.

Justin Searls