I don't know the right way to store JSON object in a sqlite text field, using nodejs sqlite3 driver. I have tried the following ways:
- I simply write JSON object without any conversion. When I look into the table,
jstrvalue looks like{"melicode":9876543210}but after retrieve itJSON.parse(jstr)fails withSyntaxError: Unexpected token m -
Then before write it to the table I tried
JSON.stringify(jobj), nowjstrvalue looks like{\"melicode\":9876543210}but when I try to convert it,JSON.parse(jstr)fails withSyntaxError: Unexpected token \It looks like
sqlite3omits double quotes when retrieveTEXT, no matter it has a '\' char before or not.
Aucun commentaire:
Enregistrer un commentaire