开发者

How to check this Json response whether its null or not

开发者 https://www.devze.com 2023-03-11 21:33 出处:网络
{\"PatientPastMedicalHistoryGetResult\":{\"PastMedicalHistory\":[]}} The PastMedicalHistory array is NU开发者_如何转开发ll without values. How can i check it.if (response.PatientPastMedicalHistoryGe
{"PatientPastMedicalHistoryGetResult":{"PastMedicalHistory":[]}}

The PastMedicalHistory array is NU开发者_如何转开发ll without values. How can i check it.


if (response.PatientPastMedicalHistoryGetResult.PastMedicalHistory.length == 0) {

}

And this isn't null. This is an empty array.


If you have null in response, Try

   var data = {"PatientPastMedicalHistoryGetResult":{"PastMedicalHistory":[]}};

    for (member in data) {
        if (data[member] != null)
            // Do work here
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消