pretty print json. Also fix up validation a bit