Conform to JSON conventions by normalizing results from backend. Add tests.

Fixes #4, #5