在SQL中解析JSON字符串 [英] Parse JSON string in sql

查看:2377
本文介绍了在SQL中解析JSON字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表中有一列JSON字符串,我正在使用SQL Server 2008. 关于如何解析JSON字符串并提取特定值的任何想法吗?

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?

这是我的JSON字符串:

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?

推荐答案

由于sql server没有内置的JSON支持,因此您需要手动解析它,这会变得很复杂.

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

但是,您始终可以使用别人的 JSON解析库.

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

这篇关于在SQL中解析JSON字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆