How to get JSON object instead of string? #1098
MarByteBeep
started this conversation in
General
Replies: 2 comments 2 replies
-
You insert a string, you get a string back. There is nothing better-sqlite3 can do here. SQLite does not have a JSON column type. The current behavior is the correct behavior. You can use some sort of abstraction/ORM to achieve what you want. |
Beta Was this translation helpful? Give feedback.
0 replies
-
When I query for instance "id" directly, I get a number. Not a string. I find it confusing that the behavior is different. And I wonder if you are internally parsing it to JSON as well. Because if you do, there is a performance loss because of the needless back and forth encoding/decoding of JSON. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to store JSON objects inside a SQLite database, which seem to work fine. However when trying the retrieve the objects again,
better-sqlite3
returns a string, not the object. Obviously I could stillJSON.parse()
that string, but it would be better in my opinion if an object is returned. How can I make this happen? This is my example code:outputs
Beta Was this translation helpful? Give feedback.
All reactions