S
S
SvetlanaDubovik2017-05-26 13:12:14
HTML
SvetlanaDubovik, 2017-05-26 13:12:14

How to create html markup from json?

Hello. Tell me please. I need to output data from json file to html. JSON is something like this:

{"@attributes":{"class":"row small-padding","id":"block3"},"p":"Президент","a":["Дубовсков Андрей Анатольевич",{"@attributes":{"href":"#"},"i":{"@attributes":{"class":"fa fa-search text-default-light fa-hover"}}}],"div":{"@attributes":{"class":"row"},"div":[{"@attributes":{"class":"col-xs-3"},"p":"01.01.2001"},{"@attributes":{"class":"col-xs-1"},"p":"ИНН 0000000"}]}}

I'm studying JS recently and it's still impossible to reach with my brains.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Pushkarev, 2017-05-26
@AXP-dev

The json structure has different element structures. All elements must be brought under one standard. And then take them out after that.

S
sergski, 2017-05-26
@sergski

Will you have exactly this json?
Convert it to a JSON string using JSON.stringify, then convert it to an object using JSON.parse and choose the values ​​you want from it. Next, display the value on the page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question