Skip to content
Sharp

Design patterns · interview question

In a checkout flow, a legacy system provides order details in XML, but the new system uses JSON. What role does an Adapter play here?

Multiple choiceHardchapter-13-curatedpremiumdesign-patternsproxy-and-adapter
Choose one answer
Answer and explanation

Correct answer

D. Translates XML into JSON to ensure compatibility.

Why

The Adapter pattern is used to translate the XML order details into JSON format, ensuring compatibility between the legacy system and the new system. It acts as a structural translator.

Test yourself on Design patterns

A free test with instant, explained results. No account needed.

Start free test
All Design patterns questions →