Dev Teywa

Dev Teywa

  • NA
  • 250
  • 37.9k

How can i update array of objects using jsonPatch

Dec 24 2021 11:11 PM

Hello,

i have array of objects like this 

persons =[name:"test",age:24,hobbies:['basket','draw','football']]

if i wanna delete for example delete 'draw" i got

[
    {
        "op": "remove",
        "path": "/hobbies/2"
    },
    {
        "op": "replace",
        "path": "/hobbies/1",
        "value": 'football'
    },
    {
        "op": "replace",
        "path": "/hobbies/0",
        "value": 'basket
    },
]

 

can anyone help me plz ? thanks


Answers (1)