4

I have a column of JSON strings in my table, I'm using SQL Server 2008. Any Ideas on how to parse the JSON string and extract a specific value?

Here's my JSON String:

{"id":1234,"name":"Lasagne al frono","description":"Placerat nisi turpis, dictumst nasceture ete etiam mus nec cum platea tempori zillest. Nisi niglue, augue adipiscing ete dignissim sed mauris augue, eros!","image":"images/EmptyProduct.jpg","cartImage":"images/ArabianCoffee.jpg","basePrice":54.99,"priceAttribute":"itemPrice","attributes":[{"type":"Addons","label":"Side","attributeName":"Side","display":"Small","lookupId":8},{"type":"Addons","label":"Drink","attributeName":"drink","display":"Small","lookupId":5},{"label":"add note","type":"Text","attributeName":"notes","display":"Wide","lookupId":null}]}

I need to extract the value of "name", Any Help?

1
  • Almost dup of Parse JSON in TSQL, which asks with a parameter as a source instead of a column, but have good answers and now mention the native JSON support in SQL Server 2016. Commented Feb 26, 2016 at 12:40

3 Answers 3

8

Since sql server has no JSON support built in, you'd need to parse this manually, which would get complicated.

However, you could always use somebody else's JSON parsing library.

Sign up to request clarification or add additional context in comments.

Comments

2

For parsing JSON you can write an easy CLR Function in C# or VB.NET.

Comments

2

Now you can use MS SQL Server 2016

https://msdn.microsoft.com/en-us/library/dn921897.aspx

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.