ensure properly formatted json responses