Skip to content

Commit

Permalink
Be more liberal when detecting JSON in the formatter
Browse files Browse the repository at this point in the history
Closes #485
  • Loading branch information
jkbrzt committed Jul 1, 2016
1 parent 098257c commit 963b274
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion httpie/output/formatters/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
class JSONFormatter(FormatterPlugin):

def format_body(self, body, mime):
if 'json' in mime or self.kwargs['explicit_json']:
maybe_json = [
'json',
'javascript',
'text',
]
if (any(token in mime for token in maybe_json) or
self.kwargs['explicit_json']):
try:
obj = json.loads(body)
except ValueError:
Expand Down

0 comments on commit 963b274

Please sign in to comment.