Answer the question
In order to leave comments, you need to log in
How to get value from json to console?
This json comes from the server localhost:8888/get_serial.json and you need to get this value from it - 123456789012 to the console
{
"document": {
"data": {
"docType": 1,
"name": "С",
"fiscprops": [
{
"caption": "З",
"printable": "З\t123456789012",
"tag": 1013,
"value": "123456789012"
}
]
},
"result": 0
},
"protocol": 1,
"version": "1.0"
}
Answer the question
In order to leave comments, you need to log in
Hello.
// Парсим в объект
const json = JSON.parse('{"document": {"data": {"docType": 1, "name": "С", "fiscprops": [{"caption": "З", "printable": "123456789012", "tag": 1013, "value": "123456789012"} ] }, "result": 0 }, "protocol": 1, "version": "1.0"}');
// Выводим нужное значение
console.log(json.document.data.fiscprops[0].value);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question