Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you use SQL to SELECT values from a JSON array?

I have a database in SQL Server 2008 and one particular table has information stored in fields as JSON-encoded arrays. I'm wondering there's a SQL-based approach to select out specific values within that JSON field?

I can, of course, just select the field and parse the information out myself, but I'm trying to avoid that if at all possible.

Thanks in advance!

like image 914
tbone14 Avatar asked Jun 12 '12 16:06

tbone14


1 Answers

There's nothing natively, but the first answer on the follow question references an article about parsing JSON objects in tSQL

Parse JSON in TSQL

For reference, the article of interest is here:

http://www.simple-talk.com/sql/t-sql-programming/consuming-json-strings-in-sql-server/

like image 95
Jon Egerton Avatar answered Oct 10 '22 20:10

Jon Egerton