- I want to check that the maxprice is equal to "" this or not if it's "" then maxprice will become maxprice = 0
 
my Json
price = ({
    maxprice = "<null>";
    minprice = "<null>";
});
code
var Arr = NSArray()
Arr = result.value(forKey: "price") as! NSArray
let max = Arr.value(forKey: "maxprice")
if max == nil {
    self.MaxValue = 0
    self.MinValue = 0
}
else {
    let maxval =  (Arr.object(at: 0) as AnyObject).value(forKey: "maxprice") as! NSNumber
    let min =  (Arr.object(at: 0) as AnyObject).value(forKey: "minprice") as! NSNumber
    self.MaxValue = maxval
    self.MinValue = min
}
Error: Could not cast value of type 'NSNull' (0x102148918) to 'NSNumber' (0x10311c4a8).