cancel
Showing results for 
Search instead for 
Did you mean: 

AIKAU service with JSON parser

vincent-kali
Star Contributor
Star Contributor
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);
   }
   
   });
});




2 REPLIES 2

ddraper
World-Class Innovator
World-Class Innovator
Have you tried breaking on exceptions in your browser developer tools? If so, which line is failing and what's the exception?

I'll try this and post results back.

regards,
Vincent