Q:

Google App Script - The web app URL response is "Hello, world" instead of JSON

I am trying to learn google app script, hence I started with "Hello, World". Eventually, i borrowed a working code to return  a JSON for data saved in speadsheet. Below is the code - 
function doGet(e) {

    var json = convertSheet2JsonText();
    return ContentService.createTextOutput(JSON.stringify(json))
    .setMimeType(ContentService.MimeType.JSON);

}
function convertSheet2JsonText() {
var sheet =     
SpreadsheetApp.openById("1kQVRu_9HLAZZWReGxGQL3513ShiwUQ6Ux- 
GkjO19nWQ").getActiveSheet();
var colStartIndex = 1;
var rowNum = 1;
var firstRange = sheet.getRange(1, 1, 1, sheet.getLastColumn());
var firstRowValues = firstRange.getValues();
var titleColumns = firstRowValues[0];

// after the second line(data)
var lastRow = sheet.getLastRow();
var rowValues = [];
for(var rowIndex=2; rowIndex<=lastRow; rowIndex++) {
    var colStartIndex = 1;
    var rowNum = 1;
    var range = sheet.getRange(rowIndex, colStartIndex, rowNum,   
    sheet.getLastColumn());
    var values = range.getValues();
rowValues.push(values[0]);
}
 // create json
var jsonArray = [];
for(var i=0; i<rowValues.length; i++) {
  var line = rowValues[i];
  var json = new Object();
  for(var j=0; j<titleColumns.length; j++) {
    json[titleColumns[j]] = line[j];
  }
 jsonArray.push(json);
}
return jsonArray ;
}

I have followed the steps to deploy it as a web-app.
1. When I use the "Latest Code" link to test the code, I get expected JSON.
2. However, I use the link to "Current Web App URL", I get text "Hello World".
I created a new spreadsheet and copied the same code in script editor and deployed it as a web app. Now if I use the link "Current Web App URL", I get intended JSON.
Please let me know, in first case how can I make the prod link to send JSON instead of string "Hello World".
Please let me know in case of any questions.

A:

I changed the version and it worked.

