some json encoding tidying up
more encoding cleanup
add some json request parsing tests