From acaf5ce74211bdfa3f8cbee6e367aaf1d1ebd3df Mon Sep 17 00:00:00 2001
From: John Vandenberg <jayvdb@gmail.com>
Date: Mon, 24 Jul 2017 12:57:55 +0700
Subject: [PATCH] csvjson: Do not emit empty properties

---
 csvkit/utilities/csvjson.py          | 2 +-
 tests/test_utilities/test_csvjson.py | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/csvkit/utilities/csvjson.py b/csvkit/utilities/csvjson.py
index 5b493e8bf..d0b0c241c 100644
--- a/csvkit/utilities/csvjson.py
+++ b/csvkit/utilities/csvjson.py
@@ -134,7 +134,7 @@ def dump_json(data, newline=False):
                             max_lon = lon
                     elif i == id_column:
                         geoid = c
-                    else:
+                    elif c:
                         properties[table.column_names[i]] = c
 
                 if id_column is not None:
diff --git a/tests/test_utilities/test_csvjson.py b/tests/test_utilities/test_csvjson.py
index 25f37e4bb..177c1df18 100644
--- a/tests/test_utilities/test_csvjson.py
+++ b/tests/test_utilities/test_csvjson.py
@@ -73,7 +73,9 @@ def test_geojson(self):
         for feature in geojson['features']:
             self.assertEqual(feature['type'], 'Feature')
             self.assertFalse('id' in feature)
-            self.assertEqual(len(feature['properties']), 10)
+            self.assertIn('properties', feature)
+            self.assertIsInstance(feature['properties'], dict)
+            self.assertGreater(len(feature['properties']), 1)
 
             geometry = feature['geometry']
 
@@ -92,7 +94,9 @@ def test_geojson_with_id(self):
         for feature in geojson['features']:
             self.assertEqual(feature['type'], 'Feature')
             self.assertTrue('id' in feature)
-            self.assertEqual(len(feature['properties']), 9)
+            self.assertIn('properties', feature)
+            self.assertIsInstance(feature['properties'], dict)
+            self.assertGreater(len(feature['properties']), 1)
 
             geometry = feature['geometry']