JSON vs XML APIs
The choice between JSON and XML sits within the contract between a client and an API. A client should distinguish success, validation errors, authentication failures, rate limits and temporary server errors. JSON versus XML does not change HTTP semantics, and IPv4/IPv6 values must be preserved without IPv4-length assumptions.
How to handle the response
Validate Content-Type, status code, documented fields and quota. Handle HTTP 429 separately, respect Retry-After when supplied, and use bounded exponential backoff with jitter. Consider idempotency before retrying. Log request identifiers, status and latency, but never API secrets.
The detail that matters
JSON maps naturally to common object/array data models and is usually compact; XML supports attributes, namespaces and mature schema tooling. Choose from the API contract and ecosystem rather than assuming one format is universally faster or more correct. For a real request and the current API contract, see 2ip API.