Skip to content
Sharp

Design patterns · interview question

You need to integrate a third-party JSON-based inventory API with an existing XML-based internal system. Which pattern should you employ and why?

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

Correct answer

B. Adapter, because it allows different interfaces to work together

Why

The Adapter pattern is suitable here as it allows the JSON-based API to be used in place of the XML-based system by converting JSON to XML or vice versa.

Test yourself on Design patterns

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

Start free test
All Design patterns questions →