simple json API

this probably requires a little more testing, also you're not using done, so I imagine these tests are pretty inconsistent.