R
R
rennameduser_34322021-06-11 17:43:04
PHP
rennameduser_3432, 2021-06-11 17:43:04

How to get the parameter I need from json?

I have two parameters in the array that I need (price and data), I can’t get it

$json = $row['FNS_data'];
          echo $json['items']['price'];


spoiler
string(1440) "{"numberKkt": "00107602708218", "code": 3, "ecashTotalSum": 287300, "kktRegId": "0004879715000853 ", "requested_by_api_client": null, "totalSum": 287300, "machineNumber": "KZN045136", "sellerAddress": "[email protected]", "messageFiscalSign": 9297266365794917084, "appliedTaxationType": 1, "prepaidSum": 0, "provisionSum": 0, "operationType": 1, "retailPlace": "ozon.ru", "cashTotalSum": 0, "internetSign": 1, "fiscalSign": 2937630159, "user": "\u041e\u0411\u0429\u0415\u0421\u0422\u0412\u041e \u0421 \u041e\u0413\u0420\u0410\u041d\u0418\u0427\u0415\u041d\u041d\u041e\u0419 \u041e\u0422\u0412\u0415\u0422\u0421\u0422\u0412\u0415\u041d\u041d\u041e\u0421\u0422\u042c\u042e \"\u0418\u041d\u0422\u0415\u0420\u041d\u0415\u0422 \u0420\u0415\u0428\u0415\u041d\u0418\u042f\"", "fiscalDocumentFormatVer": 2, "buyerPhoneOrAddress": "[email protected]", "fiscalDriveNumber": "9289440300745441", "creditSum": 0, "requested_at": "2021-04-02T14:29:36.784192Z", "items": [{"name": "\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0430\u0432\u0430\u043d\u0441\u0430", "payMethod": 3, "price": 287300, "paymentType": 3, "productType": 1, "nds": 3, "ndsSum": 47883, "sum": 287300, "unit": "\u0448\u0442", "quantity": 1}], "region": "77", "fiscalDocumentNumber": 160517, "dateTime": "2021-04-02T13:34:00", "redefine_mask": 2, "nds18118": 47883, "ofdId": "ofd7", "userInn": "7704217370", "requestNumber": 1793, "shiftNumber": 34}"


dateTime and price parameters

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rennameduser_3432, 2021-06-11
@rennameduser_3432

thank you galaxy

$a = json_decode($s, true);
echo $a['items'][0]['price'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question