1 2 3 Previous Next 39 Replies Latest reply on Jan 15, 2018 8:26 AM by Richard Mundell Go to original post
      • 15. Re: JSON Sample Connector Thread
        Leslie Foster

        I have just figured out the problem.  As it happens, I was accidentally returning a "500" error.  The browsers (and curl) that I had used to test the page never reported this.  Since nothing was really wrong, there was no error log on my server.


        On the brighter side, this at least shows that the format I pasted in above does work.  I have been able to push that data into Tablea and am looking at it now.  There was no need to set a specific name to the array or to include a separate headers object.


        Thanks for any time you may have spent here.

        • 16. Re: JSON Sample Connector Thread
          Michael Goo



          I have been able to successfully utilize the jsonConnector.html but there is one issue around Dates not being displayed. The connector automatically detects the field as DateTime data types but data isn't coming through and is being displayed as null.


          When I change the format to "5/6/2016 12:00:00 AM" the date comes through (I don't have the option of changing how the date comes through).


          Sample jSON data:



                "trainNumber": "8",

                "trainIndexDate": "May 6, 2016 12:00:00 AM",

                "serviceNumber": 16,

                "serviceName": "Empire Builder      ",

                "trainStatus": "En-Route - Late",

                "minutesEarlyLate": 29,

                "currentLocation": "EVR",

                "nextLocation": "LWA",

                "trainsDownRoute": 0,

                "trainsUpRoute": 0,

                "scheduledArrival": "May 6, 2016 8:39:00 PM",

                "scheduledDeparture": "May 6, 2016 8:39:00 PM",

                "actualArrival": "May 6, 2016 8:34:00 PM",

                "actualDeparture": "May 6, 2016 8:39:00 PM",

                "scheduledArrivalNextLocation": "May 6, 2016 11:00:00 PM",

                "consistCount": 8,

                "crewCount": 14,

                "passengerCount": "128",

                "passengerToolTip": " ",

                "origin": "SEA",

                "destination": "CHI",

                "timeZoneOffset": 0,

               "etaNextLocation": "May 6, 2016 11:29:00 PM",

                "etaFinalLocation": "May 8, 2016 4:33:00 PM",

                "timeZoneNextLocation": "0",

                "timeZoneFinalLocation": "2",

                "connectingPassengerCount": "0",

                "liftedPassengerCount": "115",

                "serviceDisruption": "",

                "formattedScheduledArrival": "",

                "formattedScheduledDeparture": "",

                "formattedEtaNextLocation": "8:29 PM PDT",

                "formattedEtaFinalLocation": "3:33 PM CDT"


          • 17. Re: JSON Sample Connector Thread
            udit panchal

            When I first load the URL into Tableau, a message appears stating that the URL points to a website, not a web data connector. It does let me login, though, and gets me to the date range selector, where the "not a WDC" message disappears. At that point, when I click the button to retrieve data



            The table "[TableauTemp].[webdata-direct.1so30rd1780zgp12jhg2h1f455xq]" does not exist.

            • 18. Re: JSON Sample Connector Thread
              Leslie Foster

              Hi, Michael:

              Isn't jsonConnector.html heavily fortified with JavaScript?  Maybe you could modify the dates there.  If you find and modify the javascript (whether it is in the same HTML or an included file), you should be able to parse your incoming dates.

              • 19. Re: JSON Sample Connector Thread
                Michael Goo



                Do you know where in the code I would be able to identify the column or data within the Array and change the formatting? The fieldName and fieldTypes are dynamically loaded into an Array. Since I am not a coder I am looking for the place within the file to to reference the array, examine the values being loaded in the array and then format the dates.


                (function() {



                  var myConnector = tableau.makeConnector();



                  myConnector.init = function () {

                    tableau.connectionName = 'JSON data';





                  myConnector.getColumnHeaders = function() {

                    _retrieveJsonData(function (tableData) {

                      var headers = tableData.headers;

                      var fieldNames = [];

                      var fieldTypes = [];



                      for (var fieldName in headers) {

                        if (headers.hasOwnProperty(fieldName)) {





                      tableau.headersCallback(fieldNames, fieldTypes); // tell tableau about the fields and their types




                  myConnector.getTableData = function (lastRecordToken) {

                    _retrieveJsonData(function (tableData) {

                      var rowData = tableData.rowData;

                      tableau.dataCallback(rowData, rowData.length.toString(), false);



                • 20. Re: JSON Sample Connector Thread
                  udit panchal

                  hey brendon,


                  I still see that problem. and when i see the logs. i see RefrenceError: cant find variable: _wdc

                  • 21. Re: JSON Sample Connector Thread
                    Leslie Foster


                    I am not a bona fide JavaScript programmer.  I have done a bit with it in the past, and I can usually find what I need.  With that caveat in mind, I suggest you look at "getTableData"--the last function.  It looks like the "rowData" object might be the thing to modify.  You can verify that you are on the right track, by adding a dummy column to that.  I would work with some nice JavaScript tools if I were you.  Sorry, I cannot suggest any, except perhaps an IDE like IntelliJ.


                    That being said, if you are getting your feet wet (or your hands dirty?) with coding, maybe you should go back and look at the feeder RESTful service itself.  In my case, I modified the HTML part from Tableau to remove some of the unused inputs, and leave only the one for the URL.  But I have a more robust Web Service as the feed.  If you really have no control over the RESTful service, then this JS approach might be best.  In my humble opinion, this whole web-service approach is to give you a lot more flexibility over a straight database pull.  In your case, it might just be considered an adapter to be set and forgot.


                    Good luck!

                    • 22. Re: JSON Sample Connector Thread
                      Michael Goo



                      What I've found is that by commenting out the the 'bolded' text it changes the data type to a string. I can then convert the value from a string to a date. It adds an extra step but at least I can get the expected the results.


                      // Given a primitive, tries to make a guess at the data type of the input

                      function _determineType(primitive) {

                        // possible types: 'float', 'date', 'datetime', 'bool', 'string', 'int'

                        if (parseInt(primitive) == primitive) return 'int';

                        if (parseFloat(primitive) == primitive) return 'float';

                      //  if (isFinite(new Date(primitive).getTime())) return 'datetime';

                        return 'string';

                      • 23. Re: JSON Sample Connector Thread
                        Venkatesh Alagarsamy

                        Hi Nicolos -


                        The code gives me an error that _buildConnectionUrl not defined.i am getting sames error as Meg

                        • 24. Re: JSON Sample Connector Thread
                          chaim jaskoll

                          hi UDIT

                          ever resolve?

                          • 25. Re: JSON Sample Connector Thread
                            Jim Wu

                            Hi Nicolas,


                            I've been trying to parse a link to a Json with some difficulty. For some reason, when I try to put in api paramaters, I get:


                            Could not load url: http://{My Sonarqube server}/api/resources?metrics=sqale_rating_file_distribution

                            The table "[TableauTemp].[webdata-direct.1gojpiy1wolyw11c4jb44016iz3i]" does not exist.


                            But when I just call http://{My Sonarqube server}/api/resources without the metrics=sqale_rating_file_distribution parameter, the data connector works fine. I can confirm that it is a valid link (I put it through Postman to check) and I can parse the response fine If I just copy and paste it. Obviously, that isn't the ideal way to do things, so any help on this issue would be greatly appreciated. Thanks!

                            • 26. Re: JSON Sample Connector Thread
                              Michael Goo

                              I've discovered, with the help of Tableau, that the SDK 1.11.1 is not compatible with Server version 9.2.0. This is causing errors when using JSON connector. You can either upgrade to 9.2.1 or higher or 9.3  and or use the older SDK version, I forget the version number.



                              "<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>"

                              • 27. Re: JSON Sample Connector Thread
                                Jim Wu

                                Hi Michael,


                                I am currently using version 9.3.2 of tableau, do I still need to use an older sdk version? If so, how old?



                                • 28. Re: JSON Sample Connector Thread
                                  Michael Goo



                                  From what I understand you should be good to go.


                                  Have you used the jsonconnector.html? Which is down loadable via the SDK on their github website (GitHub - tableau/webdataconnector ).


                                  Reference that jsonconnector.html which will bring up a dialog box. Enter your jSON URL into the dialog box.


                                  That you may need to start up a local web server. I use MAMP because it has a UI, FREE, and it's simple to configure.

                                  Copy and paste your URL into the "Enter a URL for JSON Data:"


                                  It will take you to Tableau data source for you to rename and build a dashboard. Once you get it working you will have to publish the WDC to the server. (Web Data Connectors in Tableau Server )

                                  • 29. Re: JSON Sample Connector Thread
                                    Jim Wu

                                    Hi Michael,


                                    The link doesn't work in both the hosted jsonconnector and the one I put on localhost (I use tomcat). The weird thing is it just doesn't work on api parameters; all other api calls work fine