Unexpected result of json_modify call when attempting to remove a nested property

Viewed 29

I am trying to remove nested property from a json using json_modify function and i am getting unexpected result.

declare @json as varchar(200) = '{"Location":{"Type":"town"},"Nearby":{"Radius":100000,"Latitude":38,"Longitude":10}}'
select json_modify(@json, '$.Location.Type', null)

I would expect to get:

{"Nearby":{"Radius":100000,"Latitude":38,"Longitude":10}}

but instead i get:

{"Location":{"Latitude":38,"Longitude":10}}

which does look completely wrong. Is there an explanation of such a behavior?

0 Answers
Related