Add json workaround
This commit is contained in:
1 parent
031601d49c
commit
070d72a4ad
2 files changed
+14
-1
No files matched your search
@@ -671,6 +671,17 @@ namespace HttpClient
|
||||
return invalid
|
||||
end if
|
||||
m._json = ParseJson(text)
|
||||
' TODO:P2 remove workaround after a fix has landed
|
||||
if m._json = invalid and m.IsSuccess() and not m._json_workaround_tried = true
|
||||
' A bug was introduced in Roku OS 14.1 that causes ParseJson to return invalid parsing some unicode characters.
|
||||
' So we filter out \uXXXX characters and try to parse again.
|
||||
' These characters are mostly emojis, and can't render anyway.
|
||||
m._json_workaround_tried = true
|
||||
filter = /\\u[0-9a-fA-F]{4}/
|
||||
text = filter.ReplaceAll(text, "")
|
||||
m._json = ParseJson(text)
|
||||
LogWarn("Failed to parse JSON. Workaround applied. Success:", m._json <> invalid)
|
||||
end if
|
||||
return m._json
|
||||
end function
|
||||
|
||||
|
||||
Reference in new issue
Block a user