JSON.parse: unexpected character at line 1 column 1 of the JSON data

7901
10
Jump to solution
08-09-2017 01:55 PM
AmyRoust
Occasional Contributor III

Has anyone seen this message on their web app after deployment?

I just upgraded to WABDE version 2.5 today and the only change I made was to try to turn on the splash screen feature. When I hit Preview, everything works great. When I download the code and deploy it on my server, I get that error message and the map never loads. It's not happening on any of my other web apps, including ones I have updated today.

0 Kudos
1 Solution

Accepted Solutions
AmyRoust
Occasional Contributor III

I found the root cause of my issue. You cannot put special characters in the Widget label field, as they will be misinterpreted when the Javascript tries to execute. Here's what I had. Note the colon -- that is bad news!

**shakes fist at special characters**

View solution in original post

10 Replies
RobertScheitlin__GISP
MVP Emeritus

Amy have you looked in the main config.json for any syntax errors? You can copy all of the text in that file and put it in JSONLint - The JSON Validator 

0 Kudos
AmyRoust
Occasional Contributor III

Just tried that at your suggestion, and it came back valid.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Amy,

   Does your browser web console show you any errors?

0 Kudos
AmyRoust
Occasional Contributor III

Yes. Here's what I see (blacked out the server name on the URL -- this is on my test server and not live):

And since that graphic nearly impossible to read:

GET
XHR
http://[servernameremoved]/propertyviewertesting/configs/Splash/config_Important%3A%20Offline%20noti... [HTTP/1.1 404 Not Found 11ms]

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Stack trace:
json@https://js.arcgis.com/3.21/init.js:147:461
p@https://js.arcgis.com/3.21/init.js:146:137
f@https://js.arcgis.com/3.21/init.js:138:503
g@https://js.arcgis.com/3.21/init.js:143:291

It is not insignificant that there is an error on the Splash config because in WABDE, I removed that widget before I downloaded the code package. I wonder if there is an error with the Splash widget in version 2.5 that is leaving residual code when it is added and then removed?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Amy,

   Check your main config.json for any reference to "splash". If there is you should remove it manually (being sure to lint your json after changes to ensure validity).

AmyRoust
Occasional Contributor III

That did the trick. I had to delete this block of code:

     {
        "uri": "widgets/Splash/Widget",
        "position": {
          "relativeTo": "browser"
        },
        "version": "2.5",
        "id": "widgets_Splash_Widget_49",
        "name": "Splash",
        "label": "Important: Offline notice for server upgrade",
        "config": "configs/Splash/config_Important: Offline notice for server upgrade.json",
        "visible": false
      },

I have a ticket in with Esri support. Hopefully we can get to the bottom of this because I would like to have a splash screen. Plus, I really don't want to have to manually delete a block of code every time I update the website.

RobertScheitlin__GISP
MVP Emeritus

Glad that helped. Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.

0 Kudos
AmyRoust
Occasional Contributor III

I found the root cause of my issue. You cannot put special characters in the Widget label field, as they will be misinterpreted when the Javascript tries to execute. Here's what I had. Note the colon -- that is bad news!

**shakes fist at special characters**

RobertScheitlin__GISP
MVP Emeritus

Have you tried escaping the special character?

%3A

0 Kudos