Census API Data

Ive spent days trying to figure this out. If i missed a relevant post i apologize. I’ve created what i thought would be a simple api to pull demographic info on a provided zip code. I do have that portion working, the issue is the way the response comes back. Instead of key value pairs its a nested array and i cant figure out the best way to either convert the data to key value pairs or just call them individually in a table.

here is the connector view


and here is a sample of the raw data
[
[
“B01001_001E”,
“B28002_001E”,
“B19013_001E”,
“B25009_001E”,
“B25003_002E”,
“B25064_001E”,
“B23025_001E”,
“B08013_001E”,
“B25024_001E”,
“B25002_003E”,
“zip code tabulation area”
],
[
“13055”,
“4852”,
“62244”,
“4852”,
“3728”,
“765”,
“10478”,
“132655”,
“6465”,
“1613”,
“75633”
]
]
I’m assuming my issue is because I’ve never dealt with a response that wasn’t mapped out in the connector. Any advice would be much appreciated

Do you have link to API doc?
Also, when you post JSON or script in forum, please use ``` around your text so this is properly encoded on the forum
like:

[
    [
        "B01001_001E",
        "B28002_001E",
        "B19013_001E",
        "B25009_001E",
        "B25003_002E",
        "B25064_001E",
        "B23025_001E",
        "B08013_001E",
        "B25024_001E",
        "B25002_003E",
        "zip code tabulation area"
    ],
    [
        "13055",
        "4852",
        "62244",
        "4852",
        "3728",
        "765",
        "10478",
        "132655",
        "6465",
        "1613",
        "75633"
    ]
]

https://api.census.gov/data/2022/acs/acs5
Best I can tell there isnt any further adjustments i can do pre call

This seem to be more relavant to help settings your call

I think your call is probably correct (could have been encoded differently, but I think it work)

The API will return an array that will contain two array.
I guess that each list match a value in the second list

Can you click on show raw data of the response you get?

That was the raw data I posted earlier without the qoutes. I guess what I’m wondering is there a way to transform this into a key value set. I can finally drill down if I use item# but it would be better if I could find a way to dynamically access each value. I.e. get the value of B01003_001E as opposed to manually programming for item#14 of the array. I think it will be better in future use cases. I hope I’m explaining this correctly, still fairly new to me.

The problem is that you cannot change how the API work
However, if you use the repeating group, you can use a RG that will be the list of the first list and List two:item # Current cell number

The other option you have is to create your own JS script to generate a new JSON version like

[
    {
        "name": "B01003_001E",
        "value": "100"
    }
]

Ive been playing around with the jv script idea but that one may be a little too advanced for me. Any suggestions for resources to help me improve my skills with api request. seems like everything i can find is either beginner level or advanced but not much middle gground.

You mentioned earlier that i probably could have coded this call better. Id love your opinion on how you would have done it. Like I said, im very new so im open to suggestions.

I’ve said it could have been encoded differently… not better :stuck_out_tongue: If this work for you, I don’t see any issue.
The call is correct, the response match what is expected from this API.
This can be used in Bubble without a JS script. But this is not the best payload to play with in Bubble.

The main question is how do you expect to use this call and display data.