ap2json
v2.0.1
Published
Split one AP API request into many JSON files.
Downloads
5
Readme
ap2json
TODO explain how this only does primaries for now
Convert AP API results to many JSON files, one per state-party-racetype combination.
Usage: ap2json [options]
Options:
-f, --file File containing API election results. Must have a <races> field. [string] [required]
-d, --directory Directory where ap2json will place the output JSON files. [string] [required]
-c, --clear Whether to clear output directory before writing output files. [boolean] [default: true]
Examples:
ap2json -f results.json -d output -c false
Real-world example
curl 'https://api.ap.org/v2/elections/2016-02-01?statepostal=IA&test=true&level=ru&apikey=<APTOKEN>&format=json' > ia.json
ap2json -f ia.json -d races
Install
npm install -g ap2json