alexa

Casting golang byte array to node json in Node.js ?

Casting golang byte array to node json in Node.js ?

So in your case, it should give something like this:

 var binaryString = '\x7FO\x7F\x01\x03\x01\x01\x07Product\x01\x7F\x02\x00\x01\x0F\x01\x04Name\x01\f\x00\x01\x02Id\x01\f\x00\x01\x07Storeid\x01\f\x00\x01\tStoreProd\x01\f\x00\x01\x05Price\x01\b\x00\x01\bDiscount\x01\b\x00\x01\x05Brand\x01\f\x00\x01\nCategories\x01\x7F\x04\x00\x01\x04Tags\x01\x7F\x04\x00\x01\bLocation\x01\f\x00\x01\x07InStock\x01\x04\x00\x01\nExpiryDate\x01\f\x00\x01\tTotalSold\x01\x04\x00\x01\x11LastStockAddition\x01\f\x00\x01\x04Cost\x01\x04\x00\x00\x00\x16\x7F\x03\x02\x01\x01\b[]string\x01\x7F\x04\x00\x01\f\x00\x00i\x7F\x02\x01\x04Stng\x01\x05Stngp\x01\x01t\x01\x06tStngp\x01@\x01@\x01\x06String\x01\x01\x05askdl\x01\x01\x05asdas\x01\x06String\x01\x04\x01\x102021-10-03 12:13\x01\x06\x01\x102021-10-03 12:13\x01\b\x00';

const data = Buffer.from(binaryString, "binary");

console.log(data);
console.log(data.toString());

173 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online

Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry