You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because I need on_change and extract, I used the Website Agent and get the following events (The original event was too long, so I manually condensed it to ensure readability)
{
"content":"{\"id\":1000,\"des\":\"Here is the introduction!\\n1.Here is the introduction2!\",\"title\":\"Here is the title\"}"
}
In the browser enviroment, using JSON.parse(json.content) can correctly parse
In the Javascript Agent, JSON.parse(event['payload'].content) will get JavaScript error: SyntaxError: Unexpected token
I guess this might be related to escape characters, and the V8 engine in the browser handles this more effectively. So I tried using .replace(/\n/g,"\\n")
which worked, but simply using "replace" still doesn't seem good enough. Are there any other methods to better parse a string?
The text was updated successfully, but these errors were encountered:
The only thing I got to work was the Jq Agent. It would be something like this:
{
"filter": "[ .content | fromjson ]"
}
Thank you for your response, but this still won't work. Jq agent displaying an error "Invalid string: control characters from U+0000 through U+001F must be escaped"
The issue might be related to escaped characters. \\n
Because I need
on_change
andextract
, I used the Website Agent and get the following events (The original event was too long, so I manually condensed it to ensure readability)In the browser enviroment, using
JSON.parse(json.content)
can correctly parseIn the Javascript Agent,
JSON.parse(event['payload'].content)
will getJavaScript error: SyntaxError: Unexpected token
I guess this might be related to escape characters, and the V8 engine in the browser handles this more effectively. So I tried using
.replace(/\n/g,"\\n")
which worked, but simply using "replace" still doesn't seem good enough. Are there any other methods to better parse a string?
The text was updated successfully, but these errors were encountered: