Hi Saad and Ciaran,
For these type of function code related requests, the forums are probably the best place. The Github page is best for errors related to the TabPy source code itself.
In this case, this code is producing a list containing a single [nan] value which is causing the invalid JSON error. It looks like this is mostly (from my testing) due to the table calculation not being set to compute correctly. You will need to place all values on addressing so that it passes a list of all values to build the model on, not each row one at a time. In my example I placed Product Name on the visual level of detail and set the calc to compute this was in the edit table calculation dialogue:
Essentially, since the values being passed to TabPy are aggregated, any view that either has only one mark, or is set with the table calculation to compute so that data is passed one row at a time, will cause the function to be undefined and return the bad result which shows as Invalid JSON.
I've attached the workbook as well!
Working Function.twbx 429.7 KB