- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2024 10:52 AM
I have a question on UI builder script includes. I'm currently working on a script include that has a function where I'm passing in a JSON parameter with 3 elements. What I want to do in the function is set the value of each element in the JSON parameter and return it. Has anybody done something with JSON objects in a script include and be willing to share an example showing the proper syntax?
Thanks
Solved! Go to Solution.
- Labels:
-
UI Builder : Next Experience
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 10:25 AM
I don't see anything wrong with your code but still you can refer below sample code. It should help.
var jsonObj={ "JSONObject": {
"Low": false,
"Medium": false,
"High": false
}};
console.log(jsonObj);//{ JSONObject: { Low: false, Medium: false, High: false } }
if(true){
jsonObj.JSONObject["Low"]=true;
jsonObj.JSONObject["Medium"]=true;
}
console.log(jsonObj);//{ JSONObject: { Low: true, Medium: true, High: false } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 10:25 AM
I don't see anything wrong with your code but still you can refer below sample code. It should help.
var jsonObj={ "JSONObject": {
"Low": false,
"Medium": false,
"High": false
}};
console.log(jsonObj);//{ JSONObject: { Low: false, Medium: false, High: false } }
if(true){
jsonObj.JSONObject["Low"]=true;
jsonObj.JSONObject["Medium"]=true;
}
console.log(jsonObj);//{ JSONObject: { Low: true, Medium: true, High: false } }