Reputation: 327
I get as output ""10076053346""
in postgresql. This is in json format.
I want to convert it into "10076053346"
or this format 10076053346
.
So basically I want to convert it from json to int or text.
I have tried out the various cast functions but they dont seem to be working for me.
Any hints and help would be appreciated.
Upvotes: 0
Views: 34
Reputation: 8105
You can trim the quotes and then cast to int TRIM(data, '"')::int
, although the example value 10076053346
is out of the integer range, so you should go for a bigint
or numeric
instead.
SELECT TRIM(data, '"')::bigint;
Upvotes: 1