JSONKit
                                
                                 JSONKit copied to clipboard
                                
                                    JSONKit copied to clipboard
                            
                            
                            
                        Added parse option JKParseOptionNormalizeOnNull
Added parse option JKParseOptionNormalizeOnNull to use an empty string
instead of NSNull class on null value.
A client's API return a JSON with 'null' values on server error, so to avoid app crashes while expecting a string, I'm using this new flag.
Nice would be if the value could also be nil instead an Empty String.
NSDictionary doesn't accept nil as value. It's only nil when key doesn't exist, so JSONKit would have to ignore the key and it could lead to more app crashes.
Why assume that a string is the proper thing to return? If code is expecting a dictionary or a number and gets a string, bad things happen. What if the response is an empty string?
NSNull is explicit about being NULL. An empty string is not.
If it's an empty string, it will be an empty string. This pull request doesn't enforce use the new way, just add an extra flag.
NSNull could lead to troubles if you don't have control over the JSON you're using (that's my case, as I told in pull request comment).
I agree with zadr- I don't see how replacing NSNull instances with empty strings could be construed as correct behavior.  Obviously runtime errors arise by sending messages to NSNull that it doesn't respond to.  If a programmer was expecting an NSDictionary and got NSString it probably wouldn't work either.  t think it would be better just to post-process your JSON and remove the NSNulls.