我正在尝试解析已分配给 javascript 变量的 JSON,但由于它具有多个级别,我很难循环遍历它
<script type="text/javascript">
        var varJson = {
            "d": {
                "results": [
                    {
                        "__metadata": {
                            "id": "http://www.bradinsight.com/ALFAPI/AlfWebApi/Offices(100013449)",
                            "uri": "http://www.bradinsight.com/ALFAPI/AlfWebApi/Offices(100013449)",
                            "type": "AlfWebApiInfrastructure.Poco.Office"
                        },
                        "Agency": {
                            "__deferred": {
                                "uri": "http://www.bradinsight.com/ALFAPI/AlfWebApi/Offices(100013449)/Agency"
                            }
                        },
                        "Advertiser": {
                            "__deferred": {
                                "uri": "http://www.bradinsight.com/ALFAPI/AlfWebApi/Offices(100013449)/Advertiser"
                            }
                        },
                        "Contacts": {
                            "results": [
                                {
                                    "__metadata": {
                                        "id": "http://www.bradinsight.com/ALFAPI/AlfWebApi/Contacts(id=59980,jobId=1000105450)",
                                        "uri": "http://www.bradinsight.com/ALFAPI/AlfWebApi/Contacts(id=59980,jobId=1000105450)",
                                        "type": "AlfWebApiInfrastructure.Poco.Contact"
                                    },
                                    "id": 59980,
                                    "jobId": 1000105450,
                                    "mask": 67108863,
                                    "name": "Name",
                                    "jobtitle": "Job Title",
                                    "email": "email",
                                    "companyType": "companyType",
                                    "companyId": 1787,
                                    "officeId": 100013449,
                                    "address1": "address1",
                                    "address2": "",
                                    "address3": "",
                                    "address4": "",
                                    "addressTown": "addressTown",
                                    "addressPostCode": "addressPostCode",
                                    "tel": "tel",
                                    "fax": "fax",
                                    "responsibilities": "responsibilities"
                                },
                                {
                                    "__metadata": {
                                        "id": "http://www.bradinsight.com/ALFAPI/AlfWebApi/Contacts(id=64085,jobId=1000105448)",
                                        "uri": "http://www.bradinsight.com/ALFAPI/AlfWebApi/Contacts(id=64085,jobId=1000105448)",
                                        "type": "AlfWebApiInfrastructure.Poco.Contact"
                                    },
                                    "id": 64085,
                                    "jobId": 1000105448,
                                    "mask": 67108863,
                                    "name": "name",
                                    "jobtitle": "jobtitle",
                                    "email": "email",
                                    "companyType": "companyType",
                                    "companyId": 1787,
                                    "officeId": 100013449,
                                    "address1": "address1",
                                    "address2": "",
                                    "address3": "",
                                    "address4": "",
                                    "addressTown": "addressTown",
                                    "addressPostCode": "addressPostCode",
                                    "tel": "tel",
                                    "fax": "fax",
                                    "responsibilities": "responsibilities"
                                }
                            ]
                        },
                        "id": 100013449,
                        "companyId": 1787,
                        "addressLine1": "addressLine1",
                        "addressLine2": "",
                        "addressLine3": "",
                        "addressLine4": "",
                        "addressLine5": "addressLine5",
                        "postCode": "postCode",
                        "regionId": "regionId",
                        "countyId": "countyId",
                        "tvAreaId": "L",
                        "telephone": "telephone",
                        "fax": "fax8",
                        "countryId": "countryId",
                        "email": "email",
                        "isdn": null,
                        "mask": 66060287
                    }
                ]
            }
        };
        
               
        $(document).ready(function () {
            //var parsed = JSON.parse(varJson);
            alert(varJson);
        
        });
    </script>
我尝试使用这个:
$.each(varJson, function (index, item) {
              alert(item);
                });
但它只是在我的警报中说对象。