How to remove json object based on if condition

Viewed 21

I want to remove a json object from the payload based on the condition if exists.

I am try to get this done by using the following code line:

And if (reqq[0].attributes.length!=0) remove reqq[0].attributes[0].id

But I am getting this error:

>>>> js failed:
01: if (reqq[0].attributes.length!=0) remove reqq[0].attributes[0].id
<<<<
org.graalvm.polyglot.PolyglotException: SyntaxError: Unnamed:1:41 Expected ; but found reqq
if (reqq[0].attributes.length!=0) remove reqq[0].attributes[0].id

Can someone help to get this done?

0 Answers
Related