I have the following JSON schema
{
"employee":
{"display_name":"EMPLOYEE NAME:",
"format":"string",
"type":"textbox",
"dflt":"null",
"isMandatory":"true"}
}
Now I have to generate an html tag i.e
<input type="text" value="name"></input>
How do I use the JSON with jQuery? I know I have to use append method. But I’m not sure how to append JSON elements.
Thanks
You can use
$.parseJSONto parse your text into a JSON object. Then use jQuery to create any elements you want and append it where you want. (Here’s a JSFiddle)This generates the HTML:
I’m sure this is not exactly what you want, but this should definitely lead you in the right direction to solving your problem. Enjoy!