Permalink
Browse files

Wraps name properties and data in double quotes

Wraps name properties and data in double quotes to make it generate
valid JSON code.
  • Loading branch information...
1 parent 98a5388 commit 8f5e17babf6ff2b5bf24a21e4b1fd868da4f7e23 @abhishekbhardwaj committed Mar 28, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 js/functions.js
View
8 js/functions.js
@@ -136,18 +136,18 @@ $(document).ready(function () {
$('#generatedcode').text(xml);
} else if (settings.type === "jsontype") {
json += "{";
- json += "\n\tcountries: {";
- json += "\n\t\tcountry: [";
+ json += "\n\t\"countries\": {";
+ json += "\n\t\t\"country\": [";
for(var i = 0; i < valuesLength; i++) {
json += "\n\t\t\t{";
for (var j = 0; j < oLength; j++) {
var currOption = options[j];
var currValue = allValues[i][options[j]];
if (j == (oLength - 1)) {
- json += "\n\t\t\t\t" + currOption + ": '" + currValue + "'";
+ json += "\n\t\t\t\t\"" + currOption + "\": \"" + currValue + "\"";
} else {
- json += "\n\t\t\t\t" + currOption + ": '" + currValue + "',";
+ json += "\n\t\t\t\t\"" + currOption + "\": \"" + currValue + "\",";
}
}
if (i == (valuesLength - 1)) {

0 comments on commit 8f5e17b

Please sign in to comment.