You need to use the Google protobuf library: https://developers.google.com/protocol-buffers/docs/reference/python/
from google.protobuf import json_format ### code to get the object ### rec_obj = row.recommendation.text_ad_recommendation.ad json_str = json_format.MessageToJson(rec_obj) print(json_str) Adam On Tuesday, June 11, 2019 at 11:54:07 AM UTC+1, Rahul Kumar wrote: > > Hi Sai, > > I think Alexander is asking about the SDK. I am also facing the same > problem. If someone is using the python SDK for google ads API, how can one > convert the GoogleAdsRow to json. I have tried to use a CustomEncoder by > subclassing the json.JSONEncoder, but that is not the correct way as I will > never be sure if there is any particular data type that I am missing. Is > there a method like toJson() for this? > > Thanks, > Rahul > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog: https://googleadsdeveloper.blogspot.com/ =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/88e93dbb-09d7-41b2-912a-6ecab2098b6e%40googlegroups.com.