0

I have JSON definitions in a SQL table, from there I am trying to parse it into a SQL Server view or a table (anything would be helpful).

LookupJSON table has a single column called definition_JSON and an example of one value looks like this:

{"__type":"userTask","name":"Grade Report","id":4,"directApprove":false,"emailNotification":{"body":"<p>Hi, your Form was successfully submitted! <\/p>","emailType":2,"subject":"Form Submitted"},"lock":false,"submitBool":true, "submitBtn":"Submit"}

I just need to get the name, userTask and id as results.

When we tried the following query it didn't like that nested query, it is expecting JSON.

Select * 
From parseJSON (select top 1 * from LookupJSON)

We are using SQL Server 2012.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Nestalna
  • 47
  • 2
  • 13
  • 1
    Title say 2012, tags say 2008, and content say 2012 R2 (that doesn't even exists). Are you sure you are not using postdbcle sql? – Zohar Peled Mar 06 '18 at 18:14
  • @ZoharPeled: synchronized everything to "SQL Server 2012" - assuming that's what he's actually using :-) – marc_s Mar 06 '18 at 18:23
  • SQL Server 2012 – Nestalna Mar 06 '18 at 18:32
  • @ZoharPeled how is this a duplicate? Please link the "original"? – Nestalna Mar 08 '18 at 16:36
  • You need to get values from a json string. Link to the original is on the top of your question, bolded in yellow. – Zohar Peled Mar 08 '18 at 17:23
  • @ZoharPeled that post doesn't answer my question which is why I asked it. I have to put a JSON value into the parseJSON selector, I am looking for a way to insert the JSON value from another table which doesn't seem to be working. – Nestalna Mar 08 '18 at 20:20
  • What is this `parseJson`? Sql server only have json methods since 2016 version... – Zohar Peled Mar 08 '18 at 20:24
  • @ZoharPeled SQL 2016 has NATIVE json parsers (ways to read it), with older versions you have to get creative. That is why I need community help... – Nestalna Mar 08 '18 at 20:34
  • Well the linked question have some answers on how to parse json in older versions, but you claim it's not a dupe, so I try to understand why you think so... – Zohar Peled Mar 08 '18 at 22:11

0 Answers0