i am getting this error in ssms while using openjson function
JSON text is not properly formatted. Unexpected character '1' is found at position 0.
Below is my code.
DECLARE @json NVARCHAR(MAX)
set @json='{"versionId":1609921210,"companyId":36773386,"companyNote":"Company Note","filingDate":"03-10-2022 04:54:00.000","collectionEntityToCollectionStageId":491414859,"userId":924446069,"feedFileId":1,"periods":[{"estimatePeriodId":-1,"periodTypeId":1,"calendarYear":2020,"calendarQuarter":4,"fiscalChainSeriesId":0,"fiscalQuarter":4,"fiscalYear":2020,"periodEndDate":"2020/12/31","displayOrder":1,"Operation":"Insert"},{"estimatePeriodId":-2,"periodTypeId":1,"calendarYear":2021,"calendarQuarter":4,"fiscalChainSeriesId":1,"fiscalQuarter":4,"fiscalYear":2021,"periodEndDate":"2021/12/31","displayOrder":2,"Operation":"Insert"}],"estimatedetails":[{"estimateDetailId":-1,"estimatePeriodId":-1,"researchContributorId":3169,"parentFlag":1,"accountingStandardId":3,"tradingItemId":132856177,"flavorTypeId":0,"auditComment":"this is comment","Operation":"Insert","dataitems":[{"dataid":-1,"auditTypeId":286,"dataItemId":100186,"dataItemValue":1111,"Notes":"this is note","units":"Millions","currency":"KRW","estimateSplitInfoId":1320317,"dataCollectionTypeGroupId":1,"pageNo":7,"x0":406,"y0":523,"x1":580,"y1":515,"Operation":"Insert"},{"dataid":-2,"auditTypeId":286,"dataItemId":100182,"dataItemValue":2222,"Notes":"this is note","units":"Millions","currency":"KRW","estimateSplitInfoId":2,"dataCollectionTypeGroupId":1,"pageNo":7,"x0":406,"y0":523,"x1":580,"y1":515,"Operation":"Insert"},{"dataid":-3,"auditTypeId":286,"dataItemId":100182,"dataItemValue":2222,"Notes":"this is note","units":"Millions","currency":"KRW","estimateSplitInfoId":3,"dataCollectionTypeGroupId":1,"pageNo":7,"x0":406,"y0":523,"x1":580,"y1":515,"Operation":"Insert"}]}]}'
SELECT
JSON_Value (a.value, '$.versionId') as versionId,
JSON_Value (b.value, '$.estimateDetailId') as estimateDetailId,
JSON_Value (b.value, '$.estimatePeriodId') as estimatePeriodId,
JSON_Value (b.value, '$.researchContributorId') as researchContributorId,
JSON_Value (c.value, '$.dataid') as dataid,
JSON_Value (c.value, '$.auditTypeId') as auditTypeId,
JSON_Value (c.value, '$.dataItemId') as dataItemId,
JSON_Value (c.value, '$.dataItemValue') as dataItemValue,
JSON_Value (c.value, '$.Notes') as Notes
FROM OPENJSON(@json) as a
CROSS APPLY OPENJSON(a.value,'$.estimatedetails') b
CROSS APPLY OPENJSON(b.value,'$.dataitems') c
What wrong with my json or code?