Bugfixes and ruby1.8 compat and json miniparser

JSON miniparser is enough to get us by (for now) if json gem is
unavailable