Skip to content
Advertisement

Postgres & Rust R2D2: How to get array_to_json as text/string without the escaped double quotes?

I have the following SQL:

This gives me following in PSQL:

When I put a ::text:

I still get the same:

However on my rust app’s side using r2d2_postgres, I get an escaped string instead:

Rust code:

Outputs:

How I can I prevent the escaping of double quotes?

Advertisement

Answer

The quotes are only escaped during printing. They are not escaped in memory. Use println!("{}", value); if you want to print the value without the quotes.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement