#javascript #json
Вопрос:
{
"id": "order_I4rOK0TqFk3nxF",
"entity": "order",
"amount": 200000,
"amount_paid": 0,
"amount_due": 200000,
"currency": "INR",
"receipt": "recipt by me",
"offer_id": null,
"status": "created",
"attempts": 0,
"notes": [],
"created_at": 1633263345
}
Ответ №1:
Преобразуйте строку в объект Json, затем получите доступ к свойствам:
var jsonData =
{"id":"order_I4rOK0TqFk3nxF","entity":"order","amount":200000,"amount_paid":0,"amount_due":200000,"currency":"INR","receipt":"recipt by me","offer_id":null,"status":"created","attempts":0,"notes":[],"created_at":1633263345}
var id = JSON.parse(jsonData).id;