Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there a way we can only apply if condition in JUST.
The reason i am asking is because in else condition we are sending the default value which other side is not accepting?

What I have tried:

"state": "#ifcondition(#valueof($.state),New,1,
#ifcondition(#valueof($.state),Other,#valueof($.state),''))",

If my condition is false or lets say state is not new then we dont need to send the state value?
Posted
Updated 16-Nov-17 3:19am
Comments
Sibasisjena 16-Nov-17 9:24am    
Please check the code below.

var obj, isSahrukh = false;
if(isSahrukh)
{
obj = {Name:"Saharukh", Movie:"DDLJ"};
}
else
{
obj = {Name:"Amir", Movie:"Sarfarosh"}
}

You may check in chrome/any browser console.

1 solution

JSON is a representation of data only. There is no way to include code, such as your If statement. Nothing in JSON is ever executed as code.
 
Share this answer
 
Comments
[no name] 16-Nov-17 10:12am    
What I understand is, OP is referring JUST. JUST - JSON Under Simple Transformation[^]
Dave Kreskowiak 16-Nov-17 11:11am    
Whoops, missed that part.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900