I am creating a dynamic form for editing data in a json object. First, if something like this exists, let me know. I would prefer not to build it, but I searched the tool many times and found only trees such as structures that require quotation marks. I would be happy to treat all values as strings. This editing functionality is intended for end users, so you just need not to intimidate it.
So far, I have code that generates nested tables to represent a json object. A form field is displayed for each value. I would like to bind the form field to the associated json nested value. If I could store a reference to a json value, I would build an array of links to each value in the json object tree. I have not found a way to do this using javascript.
My last resort approach would be to go through the table after making the changes. I would prefer dynamic updates, but one submit would be better than nothing.
Any ideas?
{
"researcherid_id":{
"id_key":"researcherid_id",
"description":"Use to retrieve bibliometric data",
"url_template" :[
{
"name": "Author Detail",
"url": "http://www.researcherid.com/rid/${key}"
}
]
}
}
$.get('file.json',make_json_form);
function make_json_form(response) {
dataset = $.secureEvalJSON(response);
}
function show_json(form_id){
var r = {};
var el = document.getElementById(form_id);
table_to_json(r,el,null);
$('body').html(formattedJSON(r));
}
Jack source
share