简体   繁体   中英

Remove context variable in Node.js app before sending to IBM Watson Assistant

I have this code in Node.js. I need to change the value of my context property in the response to IBM Watson Assistant, but this is not working:

if(response.context.email){
      response.context.email=null;
}

What is the form to change the value of context property?

I would suggest to either use "null" as value or, better None .

You are on the client side. Only the values that you send to Watson Assistant are considered for further processing. If you change the reponse object (JSON object) to not contain any email property, it should not be available on the server side for Watson Assistant.

For manipulating the JSON object in Node.js you could look into using Object methods . This helps to delete or add properties to the response structure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM