I have a Json string. I Want to get value from that Json string.
This is my json string
{"latitude":"22.5712854"},{"longitude":"88.4266847"}
I want only latitude
and longitude
from this, using TSQL query.
I have a Json string. I Want to get value from that Json string.
This is my json string
{"latitude":"22.5712854"},{"longitude":"88.4266847"}
I want only latitude
and longitude
from this, using TSQL query.
There is no native way to parse JSON in TSQL. But Phil Factor created his own implementation of paring JSON in SQL function. More about it on simple talk blog in article: Consuming JSON Strings in SQL Server
Aslo Ric Vander Ark created his own function but I did not tested it. You can read more on article: A Function to Split JSON Data
You could use JSON Select which has several functions for extracting different datatypes from JSON. For your requirements you could do something like this:
select
dbo.JsonDecimal(my_column, 'latitude') as latitude,
dbo.JsonDecimal(my_column, 'longitude') as longitude
from my_table
DISCLOSURE: I am the author of JSON Select, and as such have an interest in you using it :)