pretty print for json with compact version optional