When Google return wrong JSON?
WinterSilence opened this issue · 9 comments
Can't repeat request where need fix JSON. Can you show example?
Please describe your problem in detail. What have you tried, what was the input and response, what was the error?
@frzsombor resend your developers: ?
at end of issue title calling "question" :)
@WinterSilence your issue doesn't give any details. I honestly cannot understand what you're asking or what problem are you having. Please, describe it in details and provide info that @frzsombor suggested.
@Stichoza It's not "bug" or "future request", it's only question about current code. Google return valid json, I cant find any reason for this fix and ask you why you: add this json fix?
I can't answer the question, but at least now I guess that @WinterSilence is talking about this part of the code and would like to know why we have to do a preg_replace
on the response body, based on $resultRegexes
(and in which cases), as it looks like we already have a valid json at that point (also I haven't tested this statement).
@frzsombor ups.. sorry, I thought that you action bot.
@WinterSilence lol, that's why I couldn't understand what did you mean by "resend your developers" 🤣
Yeah maybe Google now sends the valid JSON but I remember that sometimes there were invalid responses containing things like {"words":[,,"ok","yes",,,]}
and so on.
I hadn't tested it now, but I'm afraid there might be some extra commas left in Google's responses and if we remove the regex replacement, it might cause some errors.
@Stichoza sorry again - I really confused and thanks for answer.
I hadn't tested it now, but I'm afraid there might be some extra commas left in Google's responses and if we remove the regex replacement, it might cause some errors.
I agree with you, but we goes to other way:
We tested this package at translating changes in framework api (~50-60 pages, top 6 languages) - current api version of google translate always returns valid result, as result: we fix json only at errors at decoding.
Leaving these regex replaces as is at least for now.