Output and error write JSON objecets not just strings