AnsweredAssumed Answered

AIKAU service with JSON parser

Question asked by vincent-kali on Apr 29, 2015
Latest reply on May 12, 2015 by vincent-kali
Hi,
I'm trying to develop a custom page using new AIKAU widgets and a custom service.
When trying to call JSON.parse() from my service, it stops without any error or trace in log……
Could somebody help to investigate ?


define(["dojo/_base/declare",
        "alfresco/core/Core",
        "dojo/_base/lang",
      "alfresco/core/CoreXhr",
        "service/constants/Default",
       "dojo/json",
      "dojo/_base/array"],
function(declare, Core, lang, CoreXhr, AlfConstants, JSON, array) {

  return declare([Core, CoreXhr], {

   // other code here
   
   myFunction: function custom_myService__myFunction(response, originalRequestConfig) {
      
      this.alfLog("log", "myFunction called");
      var options = [];
      //var rawData = JSON.parse(response);
      var rawData = JSON.parse('{"hello":"world"}', true);
      // code below never executes ???
      this.alfLog("log", "rawdata: " + rawdata);
      if (rawData && rawData.aspects)
      {
         this.alfLog("log", "flag2");
         var aspects = rawData.aspects;
         for (var i=0; i<aspects.length; i++)
         {
            this.alfLog("log", "flag3");
            options.push({
               value: aspects.value,
               label: aspects.label
            });
            this.alfLog("log", "flag4");
         }
      }
      this.alfLog("log", "aspects options: " + options);
      this.alfPublish(originalRequestConfig.data.responseTopic, options);
   }
   
   });
});




Outcomes