From 59e3a7f87bd7d855774ef8caa1a7d795059251fc Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Wed, 16 Jan 2019 15:47:55 +0100
Subject: [PATCH] Fix `tootctl domains crawl` with JSON format output crash
 (#9820)

Fix #9817
---
 lib/mastodon/domains_cli.rb | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/lib/mastodon/domains_cli.rb b/lib/mastodon/domains_cli.rb
index be68ae84b9..303b8a94a0 100644
--- a/lib/mastodon/domains_cli.rb
+++ b/lib/mastodon/domains_cli.rb
@@ -140,15 +140,8 @@ module Mastodon
     end
 
     def stats_to_json(stats)
-      totals.each_key do |domain|
-        if totals[domain].is_a?(Hash)
-          totals[domain]['activity'] = stats[domain]
-        else
-          totals.delete(domain)
-        end
-      end
-
-      say(Oj.dump(totals))
+      stats.compact!
+      say(Oj.dump(stats))
     end
   end
 end
-- 
GitLab