Please post sample raw data and expected results so we can set up a test case and provide tested SQL.
I don't see 'Address' in the sample JSON so not sure I have a complete test case.
The '[' at the start designates an array.
Using what you provided, try this:
select Docket, [Count], Charge
from QueueData
cross apply OPENJSON(fieldvalue, '$' )
WITH (
Docket VARCHAR(25) '$.Conviction_Docket',
[Count] VARCHAR(25) '$.Conviction_Count',
Charge VARCHAR(25) '$.Conviction_Charge'
);
My complete test can be found here:
https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=8e51f5e25d5bbe2a68a97168862df3b6
>> is there a way to filter on the column 'Severity' = 'felony' ???
Add a where clause like any other SQL select.
select Docket, [Count], Charge, ChargeCode, Multiplier, Severity, Adult, Juvenile, Adult_Revived, Accessary, Calculation
from gss.QueueData
cross apply OPENJSON(fieldvalue, '$' )
WITH (
Docket VARCHAR(25) '$.Conviction_Docket',
[Count] VARCHAR(25) '$.Conviction_Count',
ChargeCode varchar(25) '$.Conviction_ChargeCode',
Charge VARCHAR(255) '$.Conviction_Charge',
[Multiplier] varchar(25) '$.Conviction_Multiplier',
Severity Varchar(25) '$.Conviction_Severity',
Adult varchar(25) '$.Conviction_Adult',
Juvenile varchar(25) '$.Conviction_Juvenile',
Adult_Revived varchar(25) '$.Conviction_Adult_Revived',
Accessary varchar(25) '$.Conviction_Accessary',
Calculation varchar(25) '$.Conviction_Calculation'
)
where severity='felony';
The sample you provided didn't have any felonies so here is a test with 'Duplicate':
https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=86d580f461cd696576a50e15daa0673c
The links provided by @slightwv above should be a good start.
I just wanted to add that if you have ever worked with XML data in SQL Server, working with JSON data should be very similar for you to understand.