0

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.

1 Answer 1

1

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.