Anyone seeing weird JSON stringify errors? I've se...
# suitescript
c
Anyone seeing weird JSON stringify errors? I've seen in a few accounts a failure to parse data that was stringified by SuiteScript. Which should never happen.
j
is the stringified json being returned from a suitelet? if so it might have an xml comment added to it (the error when parsing would be
Unexpected token '<'
). setting the Content-Type header on the response to application/json should prevent it from being added, and/or you can strip it out with a regex before parsing it
a
in my experience that specific error is usually an HTML native NetSuite error page its trying to return as a page for the browser to display, usually cos your suitelet is broken in some way
c
@Jonathan MacKenzie, @Anthony OConnor Thanks for the responses. This is definitely JSON that has been saved wrongly to a custom record field. Double quotes, double colons, etc. Seen it in about 5 accounts now.