Well, I have a JSON where all unicode symbols like this "★" are in this format: "\ u2605" have some way to convert those codes to the symbols when my program NodeJS read the JSON ?
Example of how it is: {"name":"\u2605 Bayonet","price":15713,"have":6,"max":6}
Example of how I want it to stay: {"name":"★ Bayonet","price":15713,"have":6,"max":6}
I've even manually replaced replace with these codes, but when I run it, it repeats JSON twice, giving replace only the first time and does not stores the changed JSON variable.
My code:
Trade.prototype.getSteamapis = function getSteamapis(callback) {
fs.readFile('./prices/730.json','utf8',function (err,body) {
if (err) {
return console.log(err);
}
body.replace("/\u2605/g","★")
body.replace("/\u2605 /g","★")
body.replace("/\u9f8d/g","龍")
body.replace("/\u58f1/g","壱")
body.replace("/\u2122/g","™")
body.replace("/\u5f10/g","弐")
body.replace("/\u738b/g","王")
console.log(body)
return body
});
})
}