• Eirikur Eiriksson - Saturday, April 29, 2017 7:06 AM

    farax_x - Saturday, April 29, 2017 4:39 AM

    Hi all,
    I have json like this
    DECLARE @j-2 NVARCHAR(max) = N'[{"Views":1,"Date":1493119613,"MediaCaption":"test"}]'

    i want to add  "size"="1000" to this array

    SET @j-2 = JSON_MODIFY(@j,'append $[0].size' , 1000)
    SELECT @j-2

    but It append "size":[1000]
    how can Id add  "size"="1000" instead of "size":[1000] ?

    Interesting, not by a 2016 box right now but have you tried skipping the enumeration?
    😎
    SET @j-2 = JSON_MODIFY(@j,'append $.size' , 1000)
    SELECT @j-2

    Yes, but I doesn't work !