Monday, May 21, 2012

how to auto convert nil to [NSNull null] when add it to array(dict)?

how to auto convert nil to [NSNull null] when add it to array(dict)?



I have some values need to be added to a array (initwithobjects), and encode to JSON string later.



As everyone knows, when array meet a nil, it will stop read next value.



As convention of JSON Array, the nil should be act as an null in ordered position.



Should I check every value, and manually convert it to [NSNull null] before add it to array?





No comments:

Post a Comment