How to check if JSON is null in swift?

前端 未结 5 1671
Happy的楠姐
Happy的楠姐 2021-02-20 14:47

I am currently working on an app which brings back json, in the following format

\"location_subtype\" = \"somevalue\"; \"location_type\" = Force;

5条回答
  •  礼貌的吻别
    2021-02-20 15:11

    in case you are using Alamofire and JSONSubscriptType use this:

    if !(parsedJSON["someKey"] == JSON.null) {
    //do your stuff 
    }
    

提交回复
热议问题