encode javascript code code example
Example 1: javascript html encode
function htmlEntities(s){
return s.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
return '&#' + i.charCodeAt(0) + ';';
});
}
Example 2: jq unencode string
# -r enable raw output
jq -r .[0].string FILE.json