developmentseed / wb-agrifood-backend

MIT License
1 stars 0 forks source link

Ensure consistent JSON formatting of response #14

Open LanesGood opened 8 months ago

LanesGood commented 8 months ago

As reported by @vgeorge :

It is currently parsing the JSON, but I’m not getting a consistent data format. Sometimes the response was grouped by type, like this:

{
"project": [
{
"id": "project-1",
...
}
],
'dataset': [
{
"id": "dataset-2",
...
}
]
}

It would be great if we could somehow make the backend add to the message a metadata field following a structured format with elements to be rendered as cards. But we can improve the JSON parsing in the frontend if not possible.

It also seems like the metadata is not always returned consistently; sometimes I get results with empty _distance fields, and sometimes empty url fields.

I also see sometimes description or sometimes summary.