A clean way to consume Data
Simply create an dynamics String. Like printf.
new jdata("My Name is {name.first}.uppercase()", {name:{first:"John"}})
If your data is an Object, like an Instance.
var templatedObject = new jdata({
firstname : "{name.first}",
lastname : "{name.last}"
},{
name : {
first : "John",
last : "Doe"
}
});
If your data is an complex Array. Like a Collection of ressources.
var dataArray = new jdata({
firstname : "{name.first}"
}, [
{
name : {
first : "John"
}
}, {
name : {
first : "Peter"
}
},{
name : {
first : "Oliver"
}
}
]);
You can notify a jdata change by placing a watcher on it:
var watcherSample = new jdata("My Name is {name}.uppercase()", {name: "John"}, function(jd) {
console.log('watcherSample has changed', jd.get());
});
If you need some json’s template in your interface, checkout the github repository to see what you can do with jQuery and Bootstrap.