Steps to reproduce:
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/getzola/zola/releases > zola-dl-data.txt
cat zola-dl-data.txt | jq '[.[] | .assets | .[] | .download_count]' > zola-dl-numbers.txt
cargo init sum_json
cd sum_json
cargo add serde_json
(in main.rs)
use std::io::{stdin, Read};
fn main () {
let mut s = stdin();
let mut buf = Vec::new();
s.read_to_end(&mut buf).unwrap();
let v: Vec<u32> = serde_json::from_slice(&buf).unwrap();
println!("{}", v.into_iter().sum::<u32>())
}
then
cat ../zola-dl-numbers.txt | cargo run --release
gives us
192682