Forum Discussion
Nikhil_Babu_Battula
Sep 29, 2023Copper Contributor
appending a string to json based on Guid
Hi Team, I have the json data like below Properties column {"State":"Received","NotificationId":"abc"} {"State":"Queued","NotificationId":"abc"} {"State":"Published","NotificationId":"abc", "S...
rutgersmeets
Oct 15, 2023Brass Contributor
bag_set_key() will be useful here.
Assuming that the column holding you JSON is called Properties and is of string type, you can use this query:
Table
| extend Properties = parse_json(Properties) // You can skip this if Properties is already of Dynamic type.
| extend Properties = iff(Properties.NotificationId == "abc", bag_set_key(Properties, "Short", "tim"), Properties)
This will set the value of Properties.Short to "tim" if Properties.NotificationId is equal to "abc". If NotificationId is something else, it will leave Properties as is.
Let me know if this helped!
Rutger