New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get raw string representation #722
Comments
(For now I’ve just put |
If you cast the column to text in the query SQL then it'll be sent over the wire as is. Ex: SELECT some_json::text FROM (SELECT '{"foo":"bar"}'::json AS some_json) t; |
+1. The big benefit here is to have all the JSON serialization already done for you, in this case the use case is proxying to a web client. What do people think of adding a config option to make this more explicit? |
If you want json to be represented as text, @sehrope has the right approach! |
I have a query which returns JSON, which I want to send back to a client in string form.
node-postgres parses my query result into an actual JavaScript object - which is useful in most cases - but here it seems wasteful to have to
JSON.stringify
what the library justJSON.parse
d.Is there a way to access the raw query result as a string (or perhaps change the query so it doesn’t get parsed at all), so I can just
res.send
the string?Thanks!
The text was updated successfully, but these errors were encountered: