Double backslash in TXT data from JSON API

We’ve noticed a potential oddity with the JSON DoH API, where there are double slashes being injected into TXT data results, which doesn’t seem right?

curl -H 'accept: application/dns-json' 'https://dns.google/resolve?name=digitalocean.com&type=TXT' | jq .Answer

...
  {
    "name": "digitalocean.com.",
    "type": 16,
    "TTL": 299,
    "data": "\"mailru-verification: 93fb13cddf97475f\""
  },
...

curl -H 'accept: application/dns-json' 'https://cloudflare-dns.com/dns-query?name=digitalocean.com&type=TXT' | jq .Answer

...
  {
    "name": "digitalocean.com",
    "type": 16,
    "TTL": 287,
    "data": "mailru-verification:\\ 93fb13cddf97475f"
  },
...

It seems like its potentially trying to escape the space, but I don’t see why this is being done or how it should be parsed on our end?

I can confirm the behavior, weirdly Google’s DNS seems to also add double string quotes while Cloudflare doesn’t. Not sure which is the correct behavior on TXT records… For sure spaces don’t need to be escaped.

I am exactly sure who to mention to help you, but I am sure @cloonan knows. I’ll take a look if we have someone to mention here. Probably the only known 1.1.1.1 person, who still works at Cloudflare, that we know here is @dane, any help?

2 Likes

Thanks, will ping the team to look into this.

4 Likes

Thanks Val! Saw your tweet as well.

PS: anyone to ping on the Community in these circumstances about 1.1.1.1?

2 Likes

Hi @matthew, the resolver currently doesn’t split the individual text chunks in the TXT response, we’ll try to fix that to be compatible.

1 Like

Ah, awesome! Is the best solution for now to replace all instances of a backslash + a space with just a space?

1 Like

Yes you basically have to unescape it twice. We’ll try to get the fixed version out next week so you don’t have to work around it.

2 Likes

This should be now resolved.

5 Likes

Can confirm, thank you very much for the quick fix on this! :heart:

1 Like