2 Replies Latest reply on Jul 20, 2018 3:37 PM by Nathan Mannheimer

    Invalid JSON using TabPy

    Saad Khan

      I am trying to plot a simple regression line using TabPy, but when compiling i get an error from tableau mentioning an invalid JSON. Any suggestions on how I can resolve this issue?Rfvl3hN.pngUwg6RR5.png

        • 1. Re: Invalid JSON using TabPy
          Ciaran Bource

          Hi Saad,


          You might get a better chance positing this on the GitHub


          Issues · tableau/TabPy · GitHub



          • 2. Re: Invalid JSON using TabPy
            Nathan Mannheimer

            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:

            Screen Shot 2018-07-20 at 3.33.01 PM.png


            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!