I
I
Ilya Loopashko2020-01-31 20:48:49
JavaScript
Ilya Loopashko, 2020-01-31 20:48:49

How to get an arbitrary element from JSON?

How to get an arbitrary element from a JSON file and display it on the page.

For example, how to get the value of the "allcoast" element and display it on the page.

If possible, tell me how to do this through Jquery and regular JS

[
  {
    "title01": "CPU",
    "title": "AMD Ryzen 5 1600 BOX",
    "shopcode": 1604575,
    "link": "",
    "cost": "8 399 Р.",
    "allcoast": "23 333"
  },
  {
    "title01": "VIDEO",
    "title": "MSI AMD Radeon RX 580 ARMOR OC [RX 580 ARMOR 8G OC]",
    "shopcode": 1113299,
    "link": "",
    "cost": "12,999 Р."
  },
  {
    "title01": "MB",
    "title": "MSI B350M PRO-VD PLUS",
    "shopcode": 1151988,
    "link": "",
    "cost": "4,250 Р."
  }
]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Yarkov, 2020-01-31
@deadloop

console.log(json[0].allcoast);
In general, go through the cycle and output.

X
xmoonlight, 2020-01-31
@xmoonlight

regex! (Yes, I'm evil! :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question