Anomaly with JSON.parse()

120 views
Skip to first unread message

Sergei Aleinik

unread,
Jan 12, 2022, 7:02:52 AM1/12/22
to Google Ads Scripts Forum
Hello!

Try to execute this snippet in Google Ads Scripts and in Google Chrome Console (or another JavaScript environment)

JSON.stringify(JSON.parse('{"0xektA1h8Zs": 1}'))

In Scripts you will get {14: 1} object as a result after JSON.parse
In Chrome you will get {"0xektA1h8Zs": 1}

But if you execute this example with another string, it will be ok in both environments. For example this snippet.

JSON.stringify(JSON.parse('{"5jvKjG0D-kU": 1}'))

As it turned out, we have a lot of issues with video (adMedia) creation because of this bug since our API returns JSON object where YouTube video ids are keys.

P. S
We have more examples where a string turns to an integer, but it's a sensitive information and I can only show you them securely.

Sergei Aleinik

unread,
Jan 12, 2022, 7:19:42 AM1/12/22
to Google Ads Scripts Forum
In new Beta scripts everything is fine, but we cannot use them because it doesn't support Video Ads. So we really need this fix in old scripts.
среда, 12 января 2022 г. в 15:02:52 UTC+3, Sergei Aleinik:

Google Ads Scripts Forum Advisor

unread,
Jan 13, 2022, 2:37:09 AM1/13/22
to adwords...@googlegroups.com
Hi Sergei,

Thank you for reporting this to us.

I've tried the reported issue, and was able to reproduce it on my end. That said, let me raise this to the rest of the team for further investigation. I'll let you know the soonest they share their findings.

In addition, you may also send other example where the issue is reproducible privately. 

Regards,
Google Logo
Teejay Wennie Pimentel
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2UjDPh:ref

Sergei Aleinik

unread,
Jan 13, 2022, 5:18:46 AM1/13/22
to Google Ads Scripts Forum
How can I send a message privately? The "Reply to author" button is disabled. The reason is "you don't have permission to reply to author in this group".

Google Ads Scripts Forum Advisor

unread,
Jan 13, 2022, 10:13:41 PM1/13/22
to adwords...@googlegroups.com
Hi Sergei,

Thanks for getting back. Harry here, I work with Teejay.

You can share private information through our email ( googleadsscr...@google.com) instead.

Thanks,
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2UjDPh:ref
Message has been deleted

Sergei Aleinik

unread,
Jan 21, 2022, 4:40:45 AM1/21/22
to Google Ads Scripts Forum
Hi! Any news on the fix to this bug?

If you will not fix it at all, please let me know
четверг, 13 января 2022 г. в 10:37:09 UTC+3, adsscripts:

Google Ads Scripts Forum Advisor

unread,
Jan 23, 2022, 11:25:32 PM1/23/22
to adwords...@googlegroups.com
Hi Sergei,

Thanks for following up here. Unfortunately, there are still no updates on the issue raised for further investigation but rest assured that I will update you of any progress made. On the other hand, I would like to offer help on addressing the issue you are encountering with creating video ads and restructuring the way you handle responses from your API as a workaround to the issue at hand for the meantime. If you would be interested on that, kindly provide your Google Ads account ID, script name and a sample response from your API that I can use to troubleshoot the issue in your script. You can use the Reply to author option to send us a message privately or through our email (googleadsscr...@google.com) instead.

Let me know your thoughts 

Thanks,
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2UjDPh:ref

Sergei Aleinik

unread,
Jan 26, 2022, 9:53:40 AM1/26/22
to Google Ads Scripts Forum
Thanks, but I will refactor code on my own.

P.S I've found another one tricky bug in video ads :(( I'll create another one thread here soon.
понедельник, 24 января 2022 г. в 07:25:32 UTC+3, adsscripts:

Google Ads Scripts Forum Advisor

unread,
Aug 18, 2022, 3:16:13 PM8/18/22
to adwords...@googlegroups.com
Hi Sergei,

I hope you're doing fine and safe. 

I just want to circle back on the reported behavior here and let you know that it is no longer reproducible. I've also confirm this on my end upon testing (please see attached screenshot).

Feel free to reach back if you still encounter the issue, so I could raise it to the team once again.

Regards,
Google Logo
Teejay Wennie
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2UjDPh:ref
3pBeAsk8Pt7rEUM.png
Reply all
Reply to author
Forward
0 new messages