I think I get it how to use the NSJSONSerialization over all. The call I am making is:
[NSJSONSerialization dataWithJSONObject:parameters options:0 error:&a
You have to use NSNull. For instance
Swift
let dict = ["firstKeyHasValue": 2342, "secondKeyHasNoValue": NSNull()]
Objective-C
NSDictionary *dict = @{ @"error": [NSNull null] };
From the official documentation of NSDictionary:
Neither a key nor a value can be nil; if you need to represent a null value in a dictionary, you should use NSNull.