Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Immutable NSJSONReadingOptions in NSJSONSerialization

To DeSerialize a JSON String I am using the following method:

+ (id)JSONObjectWithData:(NSData *)data options:(NSJSONReadingOptions)opt error:(NSError **)error

But, I found that reading option returns mutable Object. Is there a way using which I will be able receive object which is immutable?

like image 786
NNikN Avatar asked Dec 09 '25 13:12

NNikN


1 Answers

You should only get mutable objects if your NSJSONReadingOptions parameter includes NSJSONReadingMutableContainers. Indeed, when I call with options of 0, I get a standard NSDictionary, but if I use NSJSONReadingMutableContainers, I get a NSMutableDictionary. What are you using for your options value?

like image 200
Rob Avatar answered Dec 12 '25 01:12

Rob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!