bestlong / node-red-contrib-mssql-plus

A Node-RED node to read and write to Microsoft MS SQL Databases
MIT License
31 stars 18 forks source link

MSSQL 2017 with JSON feature add "JSON_F52E2B61-18A1-11d1-B105-00805F49916B" prefix to JSON resultset #20

Closed timnis closed 4 years ago

timnis commented 4 years ago

Hi,

I try use this node with MSSQL 2017 and JSON feature. Problem is that MSSQL add MS specific prefix to JSON result. Like below. String is always same.

"JSON_F52E2B61-18A1-11d1-B105-00805F49916B": "{\"ProductCode\":\"0040001\",\"ProductName\":\"Brother DK11209 osoitetarra 29x62mm\"}"

It changes JSON to JavaScript Objects says Nick O'Leary, see thread https://discourse.nodered.org/t/http-response-json-without-backslashes/19376/7?u=timnis

In node-mssql there is option "config.parseJSON = true" to strip out this MS prefix, could it be also possible to add to this node?

More info https://tediousjs.github.io/node-mssql/#json-support

timnis commented 4 years ago

I tested to add "parseJSON: true," to mssql.js config and now JSON result is correct

[{"ProductCode":"0040001","ProductName":"Brother DK11209 osoitetarra 29x62mm"}]

So it works, at least to me.