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 the csv
endpoint:
This returns a single header line ("categories"
) and then each non-null category as a regular string, on its own line:
"categories"
"Training|Use of Force"
"Narcotics"
"Traffic|Assist"
"Burglary"
"Crisis"
...