从JSON自动生成HTML [英] Automatically generate HTML from JSON

查看:313
本文介绍了从JSON自动生成HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究模板系统。我想,作为普通用户,你可以创建一个。 json文件,并根据该文件系统将自动生成html。
我对如何接近它感到很遗憾。也许我可以创建一个遍历所有对象的递归循环然后....(好吧我迷路了)。

I am working on a template system. I imagine that as a regular user you can create a. json file, and based on that file the system will automatically generate html. I am fairly lost with how to approach it. Maybe I could create a recursive loop that runs through all objects and then.... (well I'm lost).

JSON的外观示例: http://pastebin.com/cJ376fiF

An example of how the JSON could look: http://pastebin.com/cJ376fiF.

生成的HTML应如何显示: http://pastebin.com/e4EytHm1

How the generated HTML should look like: http://pastebin.com/e4EytHm1.

推荐答案

http://www.json2html.com/

json2html是一个开源的jQuery插件,它依赖于JSON转换将JSON对象转换为HTML。

"json2html is an open source jQuery plug-in that relies on JSON transforms to convert JSON objects to HTML."

这篇关于从JSON自动生成HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆