I couldn't get the protobuf to work but using the SOAP seralizer zeep this 
seems to work:
https://python-zeep.readthedocs.io/en/latest/helpers.html

from zeep import helpers

def toJSON(x):
    input_dict = helpers.serialize_object(x)
    return json.dumps(input_dict)




On Monday, April 1, 2019 at 9:12:38 PM UTC+2, Alexander Belozerov wrote:
>
> Hello there,
> Im querying google ads api and need to save results as json. What is the 
> best way to convert GoogleAdsRow type into json?
>
>
> The result of the google ads api call is GoogleAdsRow that looks like this:
>
> campaign {
>   resource_name: "customers/321/campaigns/123"
>   id {
>     value: 123
>   }
>   name {
>     value: "Campaign Name A"
>   }
> }
> metrics {
>   clicks {
>     value: 711
>   }
>   impressions {
>     value: 2662
>   }
> }
> segments {
>   device: DESKTOP
>   ad_network_type: SEARCH
>   date {
>     value: "2019-03-01"
>   }
> }
>
> Instead of campaign, it can be adgroup, keywords, etc.
> What is the best way to convert this kind of data to json?
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/a5a198c4-cf41-4db7-9271-1d15199443fb%40googlegroups.com.

Reply via email to