Hi Guys, I’m posting data from Netsuite to Zoho An...
# suitescript
n
Hi Guys, I’m posting data from Netsuite to Zoho Analytics using
context.response.writeLine(JSON.stringify(response));
I’m trying to send saved search results via this and sometimes Netsuite is adding extra comment after my JSON ends and that is giving me trouble!! Netsuite extra comment:
<!-- 9,
076 s: 67% #263 cache: 0% #14 -->
<!-- Host [ a55.prod.chi
] App Version [
2021.2.0.108
] -->
<!-- COMPID [
5454556
]  EMAIL [ <mailto:onlineformuser@5454556.com|onlineformuser@5454556.com>
] URL [ /app/site/hosting/scriptlet.nl
] Time [ Thu Feb 10 03: 16: 48 PST 2022
] -->
<!-- Not logging slowest SQL -->
I’m not understanding why this extra comments are coming in from Netsuite!! Kindly help me here if anyone knows about this issue!! Thanks!! This seems to be Server side Performance Metrics!! but I don’t want it to come in my suitelet response!!
b
Try using
context.response.write(JSON.stringify(response));
Also set content-type header beforehand
Copy code
context.response.setHeader({
    name: 'Content-Type',
    value: 'application/json',
});
context.response.write(JSON.stringify(response));
n
Thanks @burkybang!! I used this already!! thanks a lot
👍 1