Json has json schema. What are DTDs?

JSON Schema has existed for maybe 6 years in theory, in practice a few years.

As for DTD: https://en.wikipedia.org/wiki/Document_type_definition

Basically it tells the system what elements are allowed in which places and what attributes they can contain.

    <!ELEMENT html (head, body)>
Defines a html element that can contain a head and body, nothing else. Anything extra or missing will fail the validator.

It was kinda-sorta eventually superseded by XML Schema that could also define what KIND of data the attributes could contain, but did exist at the top of XML/HTML/SGML documents for years.