Creating a JSON data object

Creating a JSON data object

Hi,

I have to create a message that looks like following within Javascript. I am unable to create the portion where, "serviceDesc" addition. 

  1. {
  2.    "applicationName":"Tesing",
  3.    "projAccNumber" : "TG",                
  4.    "queueName" : "development",          
  5.    "exeuctableLocation" : "/bin/echo",    
  6.    "scratchWorkingDirectory" : "/tmp",   
  7.    "cpuCount":"12",
  8.    "hostdescName":"localhost",
  9.    "maxMemory":"0",
  10.    "maxWallTime":"0",
  11.    "minMemory":"0",
  12.    "nodeCount":"1",
  13.    "processorsPerNode":"12",
  14.    "serviceDesc":{
  15.       "serviceName" : "service1",         
  16.       "inputParams":[
  17.          {
  18.             "dataType":"input",
  19.             "description":"my input",
  20.             "name":"myinput",
  21.             "type":"String"
  22.          },
  23.          {
  24.             "dataType":"input",
  25.             "description":"my input",
  26.             "name":"myinput",
  27.             "type":"String"
  28.          }
  29.       ],
  30.       "outputParams":[
  31.          {
  32.             "dataType":"output",
  33.             "description":"my output",
  34.             "name":"myoutput",
  35.             "type":"String"
  36.          },
  37.          {
  38.             "dataType":"output",
  39.             "description":"my output",
  40.             "name":"myoutput",
  41.             "type":"String"
  42.          }
  43.       ]
  44.    }
  45. }

My javascript code looks like below. The issue happens when I create the part to add "serviceDesc" portion. What am I missing here and how can I create the specific message.
  1.             var jsonRequest = {};           
  2.             jsonRequest["name"] = "appName";
  3.             jsonRequest["executablePath"] = "exeuctableLocation";
  4.             jsonRequest["workingDir"] = "scratchWorkingDirectory";
  5.             jsonRequest["cpuCount"] = "cpuCount";
  6.             jsonRequest["hostdescName"] = "hostName";
  7.             jsonRequest["maxMemory"] = "maxMemory";
  8.             jsonRequest["maxWallTime"] = "10";
  9.             jsonRequest["minMemory"] = "4";
  10.             jsonRequest["nodeCount"] = "nodeCount";
  11.             jsonRequest["processorsPerNode"] = "3";
  12.             var inArray = [];
  13.             for(var j=1; j<inputCount+1; j++) {
  14.                 var input = {};
  15.                 input["dataType"] = "input";
  16.                 input["description"] = "empty";
  17.                 input["name"] = "name"; //$("#inputName" + j+1).val();
  18.                 input["type"] = "type"; //$("#inputType" + j+1).val();
  19.                 inArray[j-1] = JSON.stringify(input);
  20.             }
  21.             var outArray = new Array();
  22.             for(j=1; j<outputCount+1; j++) {
  23.                 var output = {};
  24.                 output["dataType"] = "output";
  25.                 output["description"] = "empty";
  26.                 output["name"] = "name"; //$("#outputName" + j+1).val();
  27.                 output["type"] = "type"; //$("#outputType" + j+1).val();
  28.                 outArray[j-1] = JSON.stringify(output);
  29.             }
  30.             var serviceDesc = {};
  31.             serviceDesc["inputParams"] = inArray;
  32.             serviceDesc["outputParams"] = outArray;
  33.             jsonRequest["serviceDesc"] = serviceDesc;
  34.             console.log(JSON.stringify(jsonRequest));