I am pulling json from an API but its format is not familiar to me.
It looks like this:
{"ok": true, "database": "boe_spending", "query_name": null, "rows": [["CITIBANK NA", 99237716.31], ["MARYLAND STATE RETIREMENT & PENSION SYSTEM", 16438857.25], ["DALY COMPUTERS INC", 9314951.79]], "truncated": false, "columns": ["payee_name_refined", "total"], "query": {"sql": "select payee_name_refined, sum(amount) as totalrnfrom vendors rnwhere agency_name = 'ALLEGANY COUNTY PUBLIC SCHOOLS'rngroup by 1rnorder by 2 descrnlimit 10", "params": {}}, "error": null, "private": false, "allow_execute_sql": true, "query_ms": 7.000529003562406}
I want to display the data in “rows” in HTML using javascript.
I am used to seeing JSON formatted like this (and I would know how to print it in my HTML):
[
{
"payee_name_refined": "CITIBANK NA",
"sum": "99237716.31"
},
{
"payee_name_refined": "MARYLAND STATE RETIREMENT & PENSION SYSTEM",
"sum": "16438857.25"
},
{
"payee_name_refined": "DALY COMPUTERS INC",
"sum": "9314951.79"
}
]
But I don’t know what to do with the data I get from the API.
Ultimately, I’d like to print the following in HTML:
CITIBANK NA, $99,237,716.31
MARYLAND STATE RETIREMENT & PENSION SYSTEM, $16,438,857.25
DALY COMPUTERS INC, $9,314,951.79
How can I use the provided JSON data to accomplish this?
Thanks for any help