mysqljs / sqlstring

Simple SQL escape and format for MySQL
MIT License
403 stars 78 forks source link

Prople with json string #41

Closed lwf804 closed 5 years ago

lwf804 commented 5 years ago

I parse object to string and save it to db. But when I parse the string to object, it get error.

Example: I save ["abc"] => '["abc"]', sqlstring format to '[\"abc\"]'. When I get from db again and json parse to object get a error:


VM47:1 Uncaught SyntaxError: Unexpected token \ in JSON at position 1
    at JSON.parse (<anonymous>)
    at <anonymous>:1:6
dougwilson commented 5 years ago

Hi @lwf804 sorry you're having issues. I'm not really understanding the report, though. Can you show the JavaScript you're using (the call to this library)?

lwf804 commented 5 years ago

Sorry, i use sqlstring with db2 to escape input value. But db2 escape rule is diff with mysql. I will close this issue!