Yes you can trivially generate forms dynamically based on some JSON.
You will need to map your JSON object into an array of keys in your router (or controller):
model: function() {
var json = {a: 'red', b: 'yellow', c: 'blue'};
var items = [], key;
for (key in json) {
if (json.hasOwnProperty(key)) {
items.push({name: key, value: json[key]});
}
}
return items;
}
And just use the each
helper in your view:
{{#each field in content}}
{{field.name}}: {{input type="text" value=field.value}}<br>
{{/each}}
I made a working JSBin with the above code.