From 3edb0d45486f0c6d6b4ce6acd8648797f3792176 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Fri, 2 Sep 2011 00:10:44 -0400 Subject: [PATCH] Fixed issue generating JSON with empty values. --- ubuntuone.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ubuntuone.js b/ubuntuone.js index fa08085..2b9273f 100644 --- a/ubuntuone.js +++ b/ubuntuone.js @@ -68,6 +68,11 @@ http.createServer(function(request, response) else { value = pieces[1]; + + if (value == '') + { + value = null; + } } line = ''; @@ -82,7 +87,16 @@ http.createServer(function(request, response) payload += ','; } - payload += '"' + variable + '":"' + value + '"'; + payload += '"' + variable + '":'; + + if (value == null) + { + payload += '""'; + } + else + { + payload += '"' + value + '"'; + } variable = ''; value = '';