jquery.json-viewer icon indicating copy to clipboard operation
jquery.json-viewer copied to clipboard

Provide some kind of render callback API

Open tdauth opened this issue 2 years ago • 0 comments

Hi, I am using a heavily modified version of this since I render stuff different depending on the context of the JSON. Somtimes I want to change values to customized URLs. Sometimes I want to fold stuff by default.

Maybe support a generic render API like:

function customRenderer(json, options) {
return {
    rendered: json2html(json, options),
    collapsed: json instanceof Array,
};
}

where o is the currently traversed json key and value. By default you do not have to register this renderer but you can do it by passing it to the options or something.

This would reduce the number of forked repositories since users can heavily modify this viewer without changing the actualy code.

tdauth avatar Mar 21 '23 13:03 tdauth