T-Sql JSON_MODIFY function has some issue its adding wrapper when appending a new value pair like
declare @jsonstring varchar(max) ='{"Width":"100%","Length":"45%"}'
select JSON_MODIFY(@jsonstring,'append $.Height ','50%' )
-- output {"Width":"100%","Length":"45%","Height":["50%"]}
-- Its adding wrapper i am unable to remove that wrapper
-- expecting output {"Width":"100%","Length":"45%","Height":"50%"}
Try this query:
declare @jsonstring varchar(max) ='{"Width":"100%","Length":"45%"}'
select JSON_MODIFY(@jsonstring,'$.Height ','50%' )
The documentation for append says:
"Optional modifier that specifies that the new value should be appended to the array referenced by < json path >."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With