Parsing Error with bannerExt in OpenRTB JSON: Expected ext Field?

25 views
Skip to first unread message

Soufian Aboulfaouz

unread,
Mar 14, 2025, 12:51:39 AM Mar 14
to Authorized Buyers API Forum
Hi all,

I’m encountering an " Cannot find field: ext in message com.google.openrtb.BidRequest.Imp.Banner" when parsing an OpenRTB JSON BidRequest

The JSON includes a bannerExt field directly under banner , but the parser expects it to be nested under ext . The error is: "Cannot find field: bannerExt in message com.google.openrtb.BidRequest.Imp.Banner". My TypeRegistry includes AdxExt.BannerExt , but it still fails unless I preprocess the JSON to rename bannerExt to ext .

Is bannerExt supposed to be ext in the JSON per the OpenRTB spec? Should I expect flexslot to be directly under ext , or is there a different extension format I should use? 

Any guidance on handling this correctly would be appreciated!

Example JSON (as received):
{ "imp" : [ { "banner" : { "w" : 300 , "h" : 250 , "bannerExt" : { "flexslot" : { "wmin" : 201 , "wmax" : 300 , "hmin" : 167 , "hmax" : 250 } } } } ] }

Java code for parsing:
TypeRegistry typeRegistry = TypeRegistry . newBuilder () . add ( AdxExt . BannerExt . getDescriptor ()) . build (); BidRequest . Builder builder = BidRequest . newBuilder (); JsonFormat . parser (). usingTypeRegistry (typeRegistry). merge (json, builder);

Authorized Buyers API Forum Advisor

unread,
Mar 14, 2025, 10:48:56 AM Mar 14
to sou...@doowaly.com, google-doubleclick-a...@googlegroups.com
Hello Soufian,

The JSON output provided doesn't look like something that came from our exchange. For example, our sample output shows that extensions under the banner use the typical ext key. Just to verify this wasn't introduced in a recent change, I also checked incoming bid requests for other partners, and see the typical ext key used rather than bannerExt . What level of confidence do you have that this came from our exchange, and has not undergone any processing on your end?

In any case, I wouldn't expect bannerExt to exist in our bid requests. If your parser expects that value, then I think that the parser itself has a bug. To be clear, the key for all extensions would be ext .

Thanks,
Google Logo
Mark Saniscalchi
Authorized Buyers API Team


Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5
[2025-03-14 14:48:52Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vH9Wy:ref" (ADR-00294120)



Soufian Aboulfaouz

unread,
Mar 14, 2025, 10:52:35 AM Mar 14
to Authorized Buyers API Forum Advisor, google-doubleclick-a...@googlegroups.com
Thanks for yor reply.

BannerExt is indeed how the json printer is dumping the json.

Regardless,  parsing the same json but with ext keys, which I did before sharing my issue in the group led to the same error.

Thanks for your feedback!

Soufian Aboulfaouz
Director

125 Wood Street, London EC2V 7AW  United Kingdom

Registered Office: 125 Wood Street, London EC2V 7AW United Kingdom
Registered in England & Wales No. 09320975

Authorized Buyers API Forum Advisor

unread,
Mar 14, 2025, 4:46:15 PM Mar 14
to sou...@doowaly.com, google-doubleclick-a...@googlegroups.com
Hello Soufian,

I see, that makes sense. It's hard to pinpoint the cause of issues in libraries we didn't produce, but one idea is that the parsing logic may have expected the extension to always be present. In practice, the extension object should only appear if at least one extension field is populated. In a hypothetical where the extension wasn't populated and your parsing logic attempted to access it, an error like "Cannot find field: ext in message com.google.openrtb.BidRequest.Imp.Banner" seems plausible.

Feel free to reach out if you have technical questions about our protocols or APIs as you build out your Real-time Bidding integration.

Thanks,
Google Logo
Mark Saniscalchi
Authorized Buyers API Team


Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-03-14 20:46:09Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vH9Wy:ref" (ADR-00294120)



Soufian Aboulfaouz

unread,
Mar 14, 2025, 10:20:53 PM Mar 14
to Authorized Buyers API Forum Advisor, google-doubleclick-a...@googlegroups.com
Dear Mark,

The library used to serialise and deserialise the messages is  com.google.protobuf.util v4.29.2 (JsonFormat).
Attached an example of json message used in this test.

I must be certainly overlooking something. 

Thanks for your help.


Soufian Aboulfaouz
+44 7470 4999 33

bid-request.json

Authorized Buyers API Forum Advisor

unread,
Mar 17, 2025, 12:32:10 PM Mar 17
to sou...@doowaly.com, google-doubleclick-a...@googlegroups.com
Hello Soufian,

Ah, I see, I hadn't considered the possibility you were using the built-in JSON functionality in the Protobuf library with a bidding endpoint receiving JSON. There's two separate topics I'd like to provide some feedback on then:
  • What is your use-case for parsing JSON requests into Protobuf? Why not use OpenRTB Protobuf format rather than JSON?
    • From my outside perspective, the usage you're describing seems like a potentially "worst of both worlds", where you lose the efficiency gains of Protobuf, but still end up implementing Google-specific logic to handle Protobuf. If you're comfortable enough to make an implementation using Protobuf-generated libraries, why not receive bid requests serialized in that form directly as opposed to spending processing power on parsing from / serializing to JSON?
  • OpenRTB JSON sent in bid requests is processed to better match the OpenRTB spec
    • The error you're receiving likely stems from the fact that processing is done on our end to better conform to the OpenRTB spec, which has subtle differences from how the Protobuf serializes to / parses from JSON. Relevant to your case, the OpenRTB spec uses simplified "ext" extension keys, as opposed to the extension keys based on the message name. Other differences also exist that could hinder your parsing/serialization; e.g. the handling of booleans or int64 fields (not exhaustive). Because JSON format bid requests sent by our exchange adhere to the OpenRTB spec, the Protobuf parser is unable to recognize the extensions with their simplified names. If you were insistent on converting JSON bid requests to Protobuf and vice versa, you could work around that with some post/pre-processing (depending on whether you're converting to/from JSON), in order to adjust the extension names. I'm don't think I could recommend such an approach though.
Thanks,
Google Logo
Mark Saniscalchi
Authorized Buyers API Team


Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-03-17 16:32:05Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vH9Wy:ref" (ADR-00294120)



Soufian Aboulfaouz

unread,
Mar 17, 2025, 12:40:18 PM Mar 17
to Authorized Buyers API Forum Advisor, google-doubleclick-a...@googlegroups.com
Thanks Mark,

We use protobuf. Json only for logging in human readable format and - in this particular case - to enrich our unit tests.

Thanks for your reply, it totally makes sense.
We built our tests on synthetic cases using protobuf as primary way. But as you may welll know, we’re looking for edge cases, and json can be helpful and easier.


Soufian Aboulfaouz
Director

125 Wood Street, London EC2V 7AW  United Kingdom

Registered Office: 125 Wood Street, London EC2V 7AW United Kingdom
Registered in England & Wales No. 09320975


On Mon, 17 Mar 2025 at 20:32, Authorized Buyers API Forum Advisor < authorize...@forumsupport.google > wrote:
Hello Soufian,

Ah, I see, I hadn't considered the possibility you were using the built-in JSON functionality in the Protobuf library with a bidding endpoint receiving JSON. There's two separate topics I'd like to provide some feedback on then:
  • What is your use-case for parsing JSON requests into Protobuf? Why not use OpenRTB Protobuf format rather than JSON?
    • From my outside perspective, the usage you're describing seems like a potentially "worst of both worlds", where you lose the efficiency gains of Protobuf, but still end up implementing Google-specific logic to handle Protobuf. If you're comfortable enough to make an implementation using Protobuf-generated libraries, why not receive bid requests serialized in that form directly as opposed to spending processing power on parsing from / serializing to JSON?
  • OpenRTB JSON sent in bid requests is processed to better match the OpenRTB spec
    • The error you're receiving likely stems from the fact that processing is done on our end to better conform to the OpenRTB spec, which has subtle differences from how the Protobuf serializes to / parses from JSON. Relevant to your case, the OpenRTB spec uses simplified "ext" extension keys, as opposed to the extension keys based on the message name. Other differences also exist that could hinder your parsing/serialization; e.g. the handling of booleans or int64 fields (not exhaustive). Because JSON format bid requests sent by our exchange adhere to the OpenRTB spec, the Protobuf parser is unable to recognize the extensions with their simplified names. If you were insistent on converting JSON bid requests to Protobuf and vice versa, you  could  work around that with some post/pre-processing (depending on whether you're converting to/from JSON), in order to adjust the extension names. I'm don't think I could recommend such an approach though.

Soufian Aboulfaouz
Director

125 Wood Street, London EC2V 7AW  United Kingdom

Registered Office: 125 Wood Street, London EC2V 7AW United Kingdom
Registered in England & Wales No. 09320975

Authorized Buyers API Forum Advisor

unread,
Mar 17, 2025, 2:37:13 PM Mar 17
to sou...@doowaly.com, google-doubleclick-a...@googlegroups.com
Hello Soufian,

Sure, I can see some value in using JSON format for readability. The sample requests and responses may provide a useful comparison between Protobuf and JSON as you build out your testing infrastructure that involves conversion to JSON.

In general, it's fair to say that the JSON format of OpenRTB used by our exchange will continue to adhere to the spec such that it  can cause future incompatibilities in cases where Protobuf's built-in JSON tooling deviates from it. Once you have covered the existing edge cases, I wouldn't expect new kinds to be introduced often, but it's worth noting that stability w/ the Protobuf library's JSON tooling isn't something we guarantee.

In any case, it sounds like you're making good progress on your migration! Feel free to reach out if you have any additional technical questions about our APIs or protocols that I can assist with.

Thanks,
Google Logo
Mark Saniscalchi
Authorized Buyers API Team


Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-03-17 18:37:09Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vH9Wy:ref" (ADR-00294120)



Reply all
Reply to author
Forward
0 new messages