简体   繁体   中英

How to append external JSON in plain HTML?

I'm trying to output some values taken from an API (JSON-formatted). And can't find a solution on how to grab the JSON tags and make them turn into HTML. JSON example here . How do I get that JSON to turn out as DIV-tags, paragraphs and headings?

you need to code that. there are already existing libraries who can help you there: http://json2html.com/

There's no 1-to-1 mapping between JSON and HTML. You will have to do that manually depending on the JSON structure. So for example you could access inidividual elements of your object like this:

result.glossary.GlossDiv.GlossList.GlossEntry.ID

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM