Remixml converter between HTML and JSON
Remixml component that renders directly to and from the javascript objects that can be converted to JSON and back.
Basic usage
From HTML to JSON and back:
var htmlstring = "<h1>This is a test</h1><p class='main'>Foo Bar</p>";
var abstract = Remixml.compile(htmlstring)({});
Remixmljsobj.abstract2jsobj(abstract);
console.log(JSON.stringify(abstract));
Remixmljsobj.jsobj2abstract(abstract);
var newstring = Remixml.abstract2txt(abstract, 1);
console.log(newstring);
Requirements
It runs inside any webbrowser or NodeJS environment.
Reference documentation
-
Remixmljsobj.abstract2jsobj(abstract)
Converts a DOMabstract
into a Javascript object, the function is destructive to theabstract
argument and performs an in-situ transformation. UseJSON.stringify()
to turn it into JSON. -
Remixmljsobj.jsobj2abstract(jsobj)
Converts a Javascript object to a DOMabstract
, the function is destructive to theabstract
argument and performs an in-situ transformation. UseJSON.parse()
to convert from JSON to the Javascript object.
References
- Postprocessor for the high performance Javascript templating engine Remixml.
- Compatible with the fastest lockandload AMD-loader.
Card-carrying member of the zerodeps
movement.