Edit json

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

    I want to edit "MediaCaption" value. this query doesnt work because its array :

    SET @j = JSON_MODIFY(@j,'$.MediaCaption' , N'hi')
    SELECT @j

    how can I do this?

  • Something like this?
    SET @j = JSON_MODIFY(@j,'$[0].MediaCaption' , N'hi')


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply