Format Query as JSON