V
V
Vladimir Zuev2020-06-02 16:48:42
Arrays
Vladimir Zuev, 2020-06-02 16:48:42

How to determine the path to an array element?

Hello. I receive a response from Nova Poshta in the form of an array.

[20-06-02 16:36:17:270 EEST] {
  "success": true,
  "data": [
    {
      "Number": "20450243002350",
      "DocumentWeight": 0.5,
      "CheckWeight": 0,
      "DocumentCost": 40,
      "SumBeforeCheckWeight": 0,
      "PayerType": "Recipient",
      "RecipientFullName": "",
      "RecipientDateTime": "",
      "OwnerDocumentType": "",
      "ScheduledDeliveryDate": "",
      "PaymentMethod": "Cash",
      "CargoDescriptionString": "",
      "CargoType": "Parcel",
      "CitySender": "Дніпро",
      "CityRecipient": "Ірпінь",
      "WarehouseRecipient": "",
      "CounterpartyType": "",
      "Redelivery": 0,
      "RedeliverySum": "",
      "RedeliveryNum": "",
      "RedeliveryPayer": "",
      "AfterpaymentOnGoodsCost": "",
      "ServiceType": "WarehouseWarehouse",
      "UndeliveryReasonsSubtypeDescription": "",
      "WarehouseRecipientNumber": 0,
      "LastCreatedOnTheBasisNumber": "",
      "LastCreatedOnTheBasisDocumentType": "",
      "LastCreatedOnTheBasisPayerType": "",
      "LastCreatedOnTheBasisDateTime": "",
      "LastTransactionStatusGM": "",
      "LastTransactionDateTimeGM": "",
      "WarehouseRecipientInternetAddressRef": "",
      "MarketplacePartnerToken": "",
      "DateScan": "0001-01-01 00:00:00",
      "PaymentStatus": "",
      "PaymentStatusDate": "",
      "AmountToPay": "",
      "AmountPaid": "",
      "InternationalDeliveryType": "",
      "UndeliveryReasonsDate": "",
      "RecipientWarehouseTypeRef": "",
      "RedeliveryPaymentCardDescription": "",
      "OwnerDocumentNumber": "",
      "FactualWeight": "",
      "WarehouseSender": "",
      "WarehouseRecipientRef": "3321656b-bc47-11e0-9503-b808a0f711c0",
      "SenderAddress": "",
      "RecipientAddress": "",
      "OnlineCreditStatus": "",
      "VolumeWeight": "",
      "ActualDeliveryDate": "",
      "RefCitySender": "db5c88f0-391c-11dd-90d9-001a92567626",
      "RefCityRecipient": "db5c8911-391c-11dd-90d9-001a92567626",
      "CardMaskedNumber": "",
      "BarcodeRedBox": "",
      "Packaging": [],
      "Status": "Нова пошта очікує надходження від відправника",
      "StatusCode": "1",
      "RefEW": "00000000-0000-0000-0000-000000000000",
      "CounterpartySenderDescription": "",
      "CounterpartyRecipientDescription": "",
      "AnnouncedPrice": "",
      "RedeliveryPaymentCardRef": "",
      "CreatedOnTheBasis": "",
      "DatePayedKeeping": "",
      "OnlineCreditStatusCode": ""
    }
  ],
  "errors": [],
  "warnings": [
    {
      "ID_20450243002350": "Please enter a valid phone number from the express invoice to show full information"
    }
  ],
  "info": [],
  "messageCodes": [],
  "errorCodes": [],
  "warningCodes": [],
  "infoCodes": []
}

I'm trying to get the value of the "Status" key
with this code The code does not see the value Help. What's my mistake?
Status= orderList2['data']['Status'];
"Нова пошта очікує надходження від відправника"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-03-25
@sashok1337

Good afternoon. It's strange that there is no answer so far :)
orderList2['data'] is an array of objects, so it will be correct something like this:
Status = orderList2['data'][0]['Status'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question