Skip to main content

Boa noite comunidade Blip, tudo bem?

Estou com o mesmo problema com meu Json, tentei usar o Baholder e não deu certo… será que vocês conseguem me ajudar?

Estou tentando retirar a informação “ShippingEstimatedDateMax[0]” do response:

{
    "orderId": "",
    "sequence": "",
    "marketplaceOrderId": "",
    "marketplaceServicesEndpoint": "",
    "sellerOrderId": "",
    "origin": "",
    "affiliateId": "",
    "salesChannel": "1",
    "merchantName": null,
    "status": "invoiced",
    "workflowIsInError": false,
    "statusDescription": "Faturado",
    "value": ,
    "creationDate": "",
    "lastChange": "",
    "orderGroup": "",
    "totals": [
        {
            "id": "Items",
            "name": "Total dos Itens",
            "value": 3000
        }
    ],
    "items": [
        {
            "uniqueId": "",
            "id": "",
            "productId": "",
            "ean": null,
            "lockId": "",
            "itemAttachment": {
                "content": {},
                "name": null
            },
            "attachments": [],
            "quantity": 1,
            "seller": "1",
            "name": "Amostra",
            "refId": "Pa",
            "price": ,
            "listPrice": ,
            "manualPrice": null,
            "priceTags": [
                {
                    "name": "",
                    "value": -45,
                    "isPercentual": false,
                    "identifier": "",
                    "rawValue": -0.45,
                    "rate": null,
                    "jurisCode": null,
                    "jurisType": null,
                    "jurisName": null
                }
            ],
            "imageUrl": "",
            "detailUrl": "",
            "components": [],
            "bundleItems": [],
            "params": [],
            "offerings": [],
            "attachmentOfferings": [],
            "sellerSku": "",
            "priceValidUntil": null,
            "commission": 0,
            "tax": 0,
            "preSaleDate": null,
            "additionalInfo": {
                "brandName": "",
                "brandId": "2000001",
                "categoriesIds": "/233/234/",
                "categories": [
                    {
                        "id": 234,
                        "name": "A"
                    },
                    {
                        "id": 233,
                        "name": "A"
                    }
                ],
                "productClusterId": "",
                "commercialConditionId": "1",
                "dimension": {
                    "cubicweight": 0.0211,
                    "height": 4.5000,
                    "length": 5.0000,
                    "weight": 100.0000,
                    "width": 4.5000
                },
                "offeringInfo": null,
                "offeringType": null,
                "offeringTypeId": null
            },
            "measurementUnit": "un",
            "unitMultiplier": 1.0000,
            "sellingPrice": 1455,
            "isGift": false,
            "shippingPrice": null,
            "rewardValue": 0,
            "freightCommission": 0,
            "priceDefinition": {
                "sellingPrices": [
                    {
                        "value": 1455,
                        "quantity": 1
                    }
                ],
                "calculatedSellingPrice": 1455,
                "total": 1455
            },
            "taxCode": "",
            "parentItemIndex": null,
            "parentAssemblyBinding": null,
            "callCenterOperator": null,
            "serialNumbers": null,
            "assemblies": [],
            "costPrice": 1500
        }
    ],
    "marketplaceItems": [],
    "clientProfileData": {
        "id": "clientProfileData",
        "email": "",
        "firstName": " ",
        "lastName": " ",
        "documentType": "",
        "document": ",
        "phone": "",
        "corporateName": null,
        "tradeName": null,
        "corporateDocument": null,
        "stateInscription": "",
        "corporatePhone": null,
        "isCorporate": false,
        "userProfileId": "",
        "userProfileVersion": null,
        "customerClass": null
    },
    "giftRegistryData": null,
    "marketingData": null,
    "ratesAndBenefitsData": {
        "id": "ratesAndBenefitsData",
        "rateAndBenefitsIdentifiers": [
            {
                "description": "",
                "featured": false,
                "id": "",
                "name": "Pix 3%",
                "matchedParameters": {
                    "paymentMethodId": "125"
                },
                "additionalInfo": null
            }
        ]
    },
    "shippingData": {
        "id": "shippingData",
        "address": {
            "addressType": "residential",
            "receiverName": " ",
            "addressId": "",
            "versionId": null,
            "entityId": null,
            "postalCode": "",
            "city": "Guarulhos",
            "state": "SP",
            "country": "BRA",
            "street": "",
            "number": "",
            "neighborhood": "",
            "complement": null,
            "reference": null,
            "geoCoordinates": [
            ]
        },
        "logisticsInfo": [
            {
                "itemIndex": 0,
                "selectedSla": "Transportadora Package",
                "lockTTL": "11d",
                "price": 663,
                "listPrice": 663,
                "sellingPrice": 663,
                "deliveryWindow": null,
                "deliveryCompany": "Jadlog (PACKAGE)",
                "shippingEstimate": "5bd",
                "shippingEstimateDate": "2023-03-03T03:01:20.9089971+00:00",
                "slas": [
                    {
                        "id": "Transportadora Package",
                        "name": "Transportadora Package",
                        "shippingEstimate": "5bd",
                        "deliveryWindow": null,
                        "price": 663,
                        "deliveryChannel": "delivery",
                        "pickupStoreInfo": {
                            "additionalInfo": null,
                            "address": null,
                            "dockId": null,
                            "friendlyName": null,
                            "isPickupStore": false
                        },
                        "polygonName": "",
                        "lockTTL": "11d",
                        "pickupPointId": null,
                        "transitTime": "2bd",
                        "pickupDistance": 0.0
                    },
                    {
                        "id": "Normal (PAC)",
                        "name": "Normal (PAC)",
                        "shippingEstimate": "10bd",
                        "deliveryWindow": null,
                        "price": 751,
                        "deliveryChannel": "delivery",
                        "pickupStoreInfo": {
                            "additionalInfo": null,
                            "address": null,
                            "dockId": null,
                            "friendlyName": null,
                            "isPickupStore": false
                        },
                        "polygonName": "",
                        "lockTTL": "11d",
                        "pickupPointId": null,
                        "transitTime": "6bd",
                        "pickupDistance": 0.0
                    },
                    {
                        "id": "Transportadora Expresso",
                        "name": "Transportadora Expresso",
                        "shippingEstimate": "4bd",
                        "deliveryWindow": null,
                        "price": 769,
                        "deliveryChannel": "delivery",
                        "pickupStoreInfo": {
                            "additionalInfo": null,
                            "address": null,
                            "dockId": null,
                            "friendlyName": null,
                            "isPickupStore": false
                        },
                        "polygonName": "",
                        "lockTTL": "11d",
                        "pickupPointId": null,
                        "transitTime": "1bd",
                        "pickupDistance": 0.0
                    },
                    {
                        "id": "Correios (Sedex)",
                        "name": "Correios (Sedex)",
                        "shippingEstimate": "6bd",
                        "deliveryWindow": null,
                        "price": 869,
                        "deliveryChannel": "delivery",
                        "pickupStoreInfo": {
                            "additionalInfo": null,
                            "address": null,
                            "dockId": null,
                            "friendlyName": null,
                            "isPickupStore": false
                        },
                        "polygonName": "",
                        "lockTTL": "11d",
                        "pickupPointId": null,
                        "transitTime": "2bd",
                        "pickupDistance": 0.0
                    }
                ],
                "shipsTo": [
                    "BRA"
                ],
                "deliveryIds": [
                    {
                        "courierId": "JadLog",
                        "courierName": "Jadlog (PACKAGE)",
                        "dockId": "1",
                        "quantity": 1,
                        "warehouseId": "1_1",
                        "accountCarrierName": "apliquefacil",
                        "kitItemDetails": []
                    }
                ],
                "deliveryChannels": [
                    {
                        "id": "delivery",
                        "stockBalance": 0
                    },
                    {
                        "id": "pickup-in-point",
                        "stockBalance": 0
                    }
                ],
                "deliveryChannel": "delivery",
                "pickupStoreInfo": {
                    "additionalInfo": null,
                    "address": null,
                    "dockId": null,
                    "friendlyName": null,
                    "isPickupStore": false
                },
                "addressId": "0",
                "versionId": null,
                "entityId": null,
                "polygonName": "",
                "pickupPointId": null,
                "transitTime": "2bd"
            },
            {
                "itemIndex": 1,
                "selectedSla": "Transportadora Package",
                "lockTTL": "11d",
                "price": 662,
                "listPrice": 662,
                "sellingPrice": 662,
                "deliveryWindow": null,
                "deliveryCompany": "Jadlog (PACKAGE)",
                "shippingEstimate": "5bd",
                "shippingEstimateDate": "2023-03-03T03:01:20.9099985+00:00",
                "slas": [
                    {
                        "id": "Transportadora Package",
                        "name": "Transportadora Package",
                        "shippingEstimate": "5bd",
                        "deliveryWindow": null,
                        "price": 662,
                        "deliveryChannel": "delivery",
                        "pickupStoreInfo": {
                            "additionalInfo": null,
                            "address": null,
                            "dockId": null,
                            "friendlyName": null,
                            "isPickupStore": false
                        },
                        "polygonName": "",
                        "lockTTL": "11d",
                        "pickupPointId": null,
                        "transitTime": "2bd",
                        "pickupDistance": 0.0
                    },	
                    {
                        "id": "Normal (PAC)",
                        "name": "Normal (PAC)",
                        "shippingEstimate": "10bd",
                        "deliveryWindow": null,
                        "price": 752,
                        "deliveryChannel": "delivery",
                        "pickupStoreInfo": {
                            "additionalInfo": null,
                            "address": null,
                            "dockId": null,
                            "friendlyName": null,
                            "isPickupStore": false
                        },
                        "polygonName": "",
                        "lockTTL": "11d",
                        "pickupPointId": null,
                        "transitTime": "6bd",
                        "pickupDistance": 0.0
                    },
                    {
                        "id": "Transportadora Expresso",
                        "name": "Transportadora Expresso",
                        "shippingEstimate": "4bd",
                        "deliveryWindow": null,
                        "price": 769,
                        "deliveryChannel": "delivery",
                        "pickupStoreInfo": {
                            "additionalInfo": null,
                            "address": null,
                            "dockId": null,
                            "friendlyName": null,
                            "isPickupStore": false
                        },
                        "polygonName": "",
                        "lockTTL": "11d",
                        "pickupPointId": null,
                        "transitTime": "1bd",
                        "pickupDistance": 0.0
                    },
                    {
                        "id": "Correios (Sedex)",
                        "name": "Correios (Sedex)",
                        "shippingEstimate": "6bd",
                        "deliveryWindow": null,
                        "price": 869,
                        "deliveryChannel": "delivery",
                        "pickupStoreInfo": {
                            "additionalInfo": null,
                            "address": null,
                            "dockId": null,
                            "friendlyName": null,
                            "isPickupStore": false
                        },
                        "polygonName": "",
                        "lockTTL": "11d",
                        "pickupPointId": null,
                        "transitTime": "2bd",
                        "pickupDistance": 0.0
                    }
                ],
                "shipsTo": [
                    "BRA"
                ],
                "deliveryIds": [
                    {
                        "courierId": "JadLog",
                        "courierName": "Jadlog (PACKAGE)",
                        "dockId": "1",
                        "quantity": 1,
                        "warehouseId": "1_1",
                        "accountCarrierName": "apliquefacil",
                        "kitItemDetails": []
                    }
                ],
                "deliveryChannels": [
                    {
                        "id": "delivery",
                        "stockBalance": 0
                    },
                    {
                        "id": "pickup-in-point",
                        "stockBalance": 0
                    }
                ],
                "deliveryChannel": "delivery",
                "pickupStoreInfo": {
                    "additionalInfo": null,
                    "address": null,
                    "dockId": null,
                    "friendlyName": null,
                    "isPickupStore": false
                },
                "addressId": "00",
                "versionId": null,
                "entityId": null,
                "polygonName": "",
                "pickupPointId": null,
                "transitTime": "2bd"
            }
        ],
        "trackingHints": null,
        "selectedAddresses": [
        ]
    },
    "paymentData": {
        "giftCards": [],
        "transactions": [
            {
                "isActive": true,
                "transactionId": "",
                "merchantName": "",
                "payments": [
                    {
                        "id": "",
                        "paymentSystem": "125",
                        "paymentSystemName": "Pix",
                        "value": 4235,
                        "installments": 1,
                        "referenceValue": 4235,
                        "cardHolder": null,
                        "cardNumber": null,
                        "firstDigits": null,
                        "lastDigits": null,
                        "cvv2": null,
                        "expireMonth": null,
                        "expireYear": null,
                        "url": null,
                        "giftCardId": null,
                        "giftCardName": null,
                        "giftCardCaption": null,
                        "redemptionCode": null,
                        "group": "instantPayment",
                        "tid": "",
                        "dueDate": null,
                        "connectorResponses": {
                            "Tid": "",
                            "ReturnCode": "1000",
                            "Message": "Pagamento realizado com sucesso",
                            "authId": "10021",
                            "nsu": "100",
                            "acquirer": "Pix"
                        },
                        "giftCardProvider": null,
                        "giftCardAsDiscount": null,
                        "koinUrl": null,
                        "accountId": null,
                        "parentAccountId": null,
                        "bankIssuedInvoiceIdentificationNumber": null,
                        "bankIssuedInvoiceIdentificationNumberFormatted": null,
                        "bankIssuedInvoiceBarCodeNumber": null,
                        "bankIssuedInvoiceBarCodeType": null,
                        "billingAddress": null
                    }
                ]
            }
        ]
    },
    "packageAttachment": {
        "packages": [
            {
                "items": [
                    {
                        "itemIndex": 0,
                        "quantity": 1,
                        "price": 1455,
                        "description": null,
                        "unitMultiplier": 0.0
                    },
                    {
                        "itemIndex": 1,
                        "quantity": 1,
                        "price": 145,
                        "description": null,
                        "unitMultiplier": 0.0
                    }
                ],
                "courier": "Jadlog",
                "invoiceNumber": "03",
                "invoiceValue": 4235,
                "invoiceUrl": "",
                "issuanceDate": "",
                "trackingNumber": "",
                "invoiceKey": "",
                "trackingUrl": "",
                "embeddedInvoice": "",
                "type": "Output",
                "courierStatus": null,
                "cfop": null,
                "restitutions": {},
                "volumes": null,
                "EnableInferItems": null
            }
        ]
    },
    "sellers": [
        {
            "id": "1",
            "name": "",
            "logo": "h",
            "fulfillmentEndpoint": "he"
        }
    ],
    "callCenterOperatorData": null,
    "followUpEmail": "7",
    "lastMessage": null,
    "hostname": "",
    "invoiceData": {
        "address": null,
        "userPaymentInfo": null
    },
    "changesAttachment": null,
    "openTextField": null,
    "roundingError": 0,
    "orderFormId": "07c9",
    "commercialConditionData": null,
    "isCompleted": true,
    "customData": null,
    "storePreferencesData": {
        "countryCode": "BRA",
        "currencyCode": "BRL",
        "currencyFormatInfo": {
            "CurrencyDecimalDigits": 2,
            "CurrencyDecimalSeparator": ",",
            "CurrencyGroupSeparator": ".",
            "CurrencyGroupSize": 3,
            "StartsWithCurrencySymbol": true
        },
        "currencyLocale": 1046,
        "currencySymbol": "R$",
        "timeZone": ""
    },
    "allowCancellation": false,
    "allowEdition": false,
    "isCheckedIn": false,
    "marketplace": {
        "baseURL": "",
        "isCertified": null,
        "name": "defacile"
    },
    "authorizedDate": "2023-02-25T03:01:19.0000000+00:00",
    "invoicedDate": "2023-02-27T13:49:50.4377525+00:00",
    "cancelReason": null,
    "itemMetadata": {
        "Items": [
            {
                "Id": "",
                "Seller": "1",
                "Name": "A",
                "SkuName": "PD15053-a",
                "ProductId": "4101",
                "RefId": "P",
                "Ean": null,
                "ImageUrl": "",
                "AssemblyOptions": []
            },
            {
                "Id": "33272",
                "Seller": "1",
                "Name": "Amo",
                "SkuName": "Amo",
                "ProductId": "4892",
                "RefId": "G",
                "Ean": null,
                "ImageUrl": "",
                "DetailUrl": "/gr014-amostra/p",
                "AssemblyOptions": []
            }
        ]
    },
    "subscriptionData": null,
    "taxData": null,
    "checkedInPickupPointId": null,
    "cancellationData": null,
    "clientPreferencesData": {
        "locale": "pt-BR",
        "optinNewsLetter": false
    }
}

Utilizando o json:
function run(dados) {
try {
const json = JSON.parse(dados);
const logisticsInfo = json.logisticsInfo
return logisticsInfo[0].ShippingEstimatedDateMax || ‘’;
} catch (error) {
return ‘error’;
}
}

Porém, está retornando erro.
Será que estou acessando o dado errado?

Pessoal, usei:

function run(dados) {
try {
const json = JSON.parse(dados);
const shippingData = json.shippingData;
return shippingData.logisticsInfo[0].shippingEstimateDate || ‘’;
} catch (error) {
return ‘error’;
}
}

e deu certo 😃