treflehq / trefle-api

🍀 Trefle is a botanical JSON REST API for plants species, allowing you to search and query over all the registered species, and build the next gardening apps and farming robots.
https://trefle.io
GNU Affero General Public License v3.0
476 stars 50 forks source link

Empty string key in response body #98

Open mdesoto opened 3 years ago

mdesoto commented 3 years ago

Describe the bug Some keys are empty strings, and this can cause some JSON parsers to choke.

"images": {
    "": [
        {
          "id": 3544269,
          "image_url": "https://d2seqvvyy3b8p2.cloudfront.net/2d02a973edb37ab31f37e2309a05014c.jpg",
          "copyright": "© copyright of the Board of Trustees of the Royal Botanic Gardens, Kew."
        }
      ]
}

To Reproduce

https://trefle.io/api/v1/species/101119

Expected behavior I would expect that every key would have a name. There may be a reason this is not the case. If there is, it would be good to see that reason articulated in the docs.

Additional context I've seen this in a few places.