diff --git a/planet/scripts/util.py b/planet/scripts/util.py index 18cc13074..da802808c 100644 --- a/planet/scripts/util.py +++ b/planet/scripts/util.py @@ -178,16 +178,16 @@ def echo_json_response(response, pretty, limit=None, ndjson=False): elif not ndjson and hasattr(response, 'json_encode'): response.json_encode(click.get_text_stream('stdout'), limit=limit, indent=indent, sort_keys=sort_keys) - - res = response.get_raw() - if len(res) == 0: # if the body is empty, just return the status - click.echo("status: {}".format(response.response.status_code)) else: - res = json.dumps(json.loads(res), indent=indent, - sort_keys=sort_keys) - click.echo(res) - if nl: - click.echo() + res = response.get_raw() + if len(res) == 0: # if the body is empty, just return the status + click.echo("status: {}".format(response.response.status_code)) + else: + res = json.dumps(json.loads(res), indent=indent, + sort_keys=sort_keys) + click.echo(res) + if nl: + click.echo() except IOError as ioe: # hide scary looking broken pipe stack traces raise click.ClickException(str(ioe))