April 29, 2017 at 4:39 am
Hi all,
I have json like thisDECLARE @j NVARCHAR(max) = N'[{"Views":1,"Date":1493119613,"MediaCaption":"test"}]'
i want to add "size"="1000" to this array
SET @j = JSON_MODIFY(@j,'append $[0].size' , 1000)
SELECT @j
but It append "size":[1000]
how can Id add "size"="1000" instead of "size":[1000] ?
April 29, 2017 at 7:06 am
farax_x - Saturday, April 29, 2017 4:39 AMHi all,
I have json like thisDECLARE @j NVARCHAR(max) = N'[{"Views":1,"Date":1493119613,"MediaCaption":"test"}]'
i want to add "size"="1000" to this array
SET @j = JSON_MODIFY(@j,'append $[0].size' , 1000)
SELECT @j
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 = JSON_MODIFY(@j,'append $.size' , 1000)
SELECT @j
April 29, 2017 at 8:05 am
Eirikur Eiriksson - Saturday, April 29, 2017 7:06 AMfarax_x - Saturday, April 29, 2017 4:39 AMHi all,
I have json like thisDECLARE @j NVARCHAR(max) = N'[{"Views":1,"Date":1493119613,"MediaCaption":"test"}]'
i want to add "size"="1000" to this array
SET @j = JSON_MODIFY(@j,'append $[0].size' , 1000)
SELECT @j
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 = JSON_MODIFY(@j,'append $.size' , 1000)
SELECT @j
Yes, but I doesn't work !
April 29, 2017 at 10:27 am
Hi,
Have you tried enclosing the value in single-quotes?
I mean JSON_MODIFY(@j, 'append $.size', '1000')
Please let us know.
May 1, 2017 at 6:34 am
debasis.yours - Saturday, April 29, 2017 10:27 AMHi,Have you tried enclosing the value in single-quotes?
I mean JSON_MODIFY(@j, 'append $.size', '1000')
Please let us know.
My problem is about putting array instead of single value
"size"="1000" ==>ok
"size":["1000"] ==>not ok
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply