JSON.parse

by George Obregon

JavaScript

var str = `{
    "XAVResponse": {
        "Response": {
            "ResponseStatus": {
                "Code": "1",
                "Description": "Success"
            },
            "TransactionReference": {
                "CustomerContext": "Your Customer Context"
            }
        },
        "AmbiguousAddressIndicator": "",
        "Candidate": [
            {
                "AddressKeyFormat": {
                    "AddressLine": [
                        "1000 E OCEAN BLVD",
                        "UNIT 613"
                    ],
                    "PoliticalDivision2": "LONG BEACH",
                    "PoliticalDivision1": "CA",
                    "PostcodePrimaryLow": "90802",
                    "PostcodeExtendedLow": "8511",
                    "Region": "LONG BEACH CA 90802-8511",
                    "CountryCode": "US"
                }
            },
            {
                "AddressKeyFormat": {
                    "AddressLine": "1000 E OCEAN BLVD",
                    "PoliticalDivision2": "LONG BEACH",
                    "PoliticalDivision1": "CA",
                    "PostcodePrimaryLow": "90802",
                    "PostcodeExtendedLow": "8507",
                    "Region": "LONG BEACH CA 90802-8507",
                    "CountryCode": "US"
                }
            },
            {
                "AddressKeyFormat": {
                    "AddressLine": "1000 E OCEAN BLVD",
                    "PoliticalDivision2": "LONG BEACH",
                    "PoliticalDivision1": "CA",
                    "PostcodePrimaryLow": "90802",
                    "PostcodeExtendedLow": "5525",
                    "Region": "LONG BEACH CA 90802-5525",
                    "CountryCode": "US"
                }
            }
        ]
    }
}
`;
var data1 = JSON.parse(str);
var O_address = data1.XAVResponse.Candidate[0].AddressKeyFormat.AddressLine;
  if (data1.XAVResponse.Candidate[0].AddressKeyFormat.AddressLine[1] != "0"){
   O_address =...