One more thing: are you sure about the JSON output? I don't get the reason behind the array.
Why not do (one associative array)
{ "address1": balance1, "address2": balance2, ... }
Instead of
[ { "address1": balance1 }, { "address2": balance2 }, ... ]
Actually after looking at what I would be using to import this, the following would be better...
[ [ "address1", balance1 ], [ "address2", balance2 ] ]
I will be parsing this into a vector<std::pair<string,uint64_t> > which my auto JSON serialization routines for C++ would expect to be handled as above...
I recognize this is a changed requirement, so switching to it is not required to win the bounty, but it would make my life easier and thus accelerate development