0 Replies Latest reply on Oct 8, 2019 7:19 AM by John Emery

    JSON Data Field Names Contain Spaces and Special Characters

    John Emery

      Hello,

       

      I'm attempting to create a Web Data Connector based on a data set that is structured like so:

       

      {"result":{"message":"Success","result":[{"first Name":"Bobo","last Name":"Jay", "topic":"WDCs are hard"...

       

      In my JavaScript code, I am able to get the Simulator to work for fields that do not have any spaces or special characters. Unfortunately, I have not been able to find a way to get it to work when I include fields that contain spaces. Of course, most of the fields contain spaces, and my client has informed me that changing the field names is not an option.

       

      Here is an example of the section of code where I am trying to retrieve data:

           for (var i = 0, len = feat.length; i < len; i++){

                tableData.push({

                     "firstName": feat[i].["first Name"],

                     "lastName": feat[i].["last Name"],

                     "topic": feat[i].topic

                });

           }

       

      I have tried a number of combinations of brackets and quotations and nothing has worked so far.

       

      Can anybody please help me to shed light on how to do this? I am not experienced in JavaScript, so I'm hoping that this is an easy fix that I have somehow just missed during my online searches for help.

       

      Thank you,

      John