Skip to main content
3-Newcomer
June 28, 2023
Solved

want to set of session variable one parameter string value to null

Tring to set value of bsl as null but other properties values like temperature or owner should remain same in session.

 

this is the session input:

 

{"containerListFilters":{"location":[],"temperature":[{"array": [{"list_id": 1,"list_name": "RT"}]}],"owner":[], "bsl":[{"array": [{"list_id": 1,"list_name": "BSL 1"}]}]}}

 

output should be:

{"containerListFilters":{"location":[],"temperature":[{"array": [{"list_id": 1,"list_name": "RT"}]}],"owner":[], "bsl":[{"array": []}}

 

how can write the code for this?

 

 

TonyZhangAnswer
Support
July 7, 2023

Hi @PK_10315615 

Don't know how setting a JSON element is related to session parameter but you can create a custom JS service in ThingWorx with a JSON input say called "input" and output as JSON

 

input.containerListFilters.bsl[0].array = [];
result = input;

 

1 reply

TonyZhangCommunity ManagerAnswer
Support
July 7, 2023

Hi @PK_10315615 

Don't know how setting a JSON element is related to session parameter but you can create a custom JS service in ThingWorx with a JSON input say called "input" and output as JSON

 

input.containerListFilters.bsl[0].array = [];
result = input;

 

Translate