Output is
[{"categories":"Training|Use of Force"}
,{"categories":"Narcotics"}
,{"categories":"Traffic|Assist"}
,{"categories":"Burglary"}
,{"categories":"Crisis"} ...
How do I get the output to be:
["Training|Use of Force", "Narcotics", "Traffic|Assist", "Burglary", "Crisis",...]
?
Instead of requesting the
json
endpoint (which is causing you to get an array of objects back), you could instead request thecsv
endpoint:https://data.seattle.gov/resource/y2d4-ftqb.csv?$group=categories&$select=categories&$where=categories%20IS%20NOT%20NULL
This returns a single header line (
"categories"
) and then each non-null category as a regular string, on its own line: