I'm trying a simple API, and I have a strange behavior with the result.
The result is JSON formatted, the data come from a DB query.
The result has unwanted escape characters:
To be sure that this isn't due to the DB response, I've modified the payload. Now it's static.
So, i'm sure, the msg.payload, passed to http request, is without escape characters: {"type":[ {"sensor":"temperature", "unit":"celsius"}, {"sensor":"humidity", "unt":"relative"} ]}
checked with debug node, but te response from http request is still with escape characters.
How to remove them?
Do you mean the double quotes round the outside? Can you feed the response into a debug node and screenshot what you see and paste it here so we can fully understand what you mean please.
This happens because your property msg.payload.d_type is a JSON encoded string. That means it stays as a String when msg.payload is itself JSON encoded and returned.
Add a JSON node and configure it to parse msg.payload.d_type to an object before the HTTP Response node.
One option would be to add a Split node before the JSON node and a Join node afterwards. Use their default configuration and change the JSON node back to msg.payload.d_type.
Another option would be to replace the JSON node with a Function node: