How to read the DNS JSON fields

Record data and the state of the query are different layers of information.

The four record fields

name identifies the record’s owner, type identifies its record type, data contains a text representation, and ttl is the remaining cache lifetime in seconds returned by the resolver. A name and type can have multiple answers; do not assume the first array item is the only one.

Not every value is an address

A and AAAA contain addresses. MX includes preference and a hostname, TXT contains text, and SOA contains several zone parameters. Interpret the record type before processing its value rather than applying one IP address validation rule to every answer.

Partial success still needs attention

An all-types query can return records even if some upstream requests failed. The warnings array retains those failures. When processing results, read status and warnings as well as the record list instead of treating any nonempty list as a complete query.

This guide explains public DNS responses. Before changing production settings, check the documentation for your current domain and hosting providers.

Return to NEONIX →Browse other guides