Select to view content in your preferred language

"json is undefined"

2171
16
08-21-2012 09:54 AM
KevinPerry1
New Contributor
I'm a long-time programmer, but new to using the ArcGIS API.  We are attempting to implement a website based on the Kurogo framework, an open source webapp framework that includes a mapping module which interfaces with ArcGIS map services.  Very cool.  They provide a demo which uses a nice map of Boston, and the demo runs on our server just fine.  When we attempt to re-configure it to use a locally-created map, though, it blows up in the ArcGIS JSAPI code, with "TypeError: json is undefined".  The stack trace from FireBug (below) is not very helpful, considering that lines 14 and 48 of the JSAPI v=2.4compact code are each a huge mass of unreadably compressed JS.

Obviously, I'll be posting a question on the Kurogo forum shortly as well, but I was wondering whether anyone here has useful guidance on how one is supposed to debug such problems buried deep in the JSAPI code?  Or - hoping for a miracle - perhaps a suggestion about exactly what is wrong in this particular case.  Thanks.

Stack trace:

TypeError: json is undefined
()?v=2.4compact (line 48)
()?v=2.4compact (line 14)
()?v=2.4compact (line 48)
()?v=2.4compact (line 14)
()?v=2.4compact (line 48)
()?v=2.4compact (line 14)
_144()?v=2.4compact (line 14)
_142()?v=2.4compact (line 14)
()?v=2.4compact (line 14)
_144()?v=2.4compact (line 14)
_142()?v=2.4compact (line 14)
()?v=2.4compact (line 14)
()?v=2.4compact (line 48)
()?v=2.4compact (line 14)
()?v=2.4compact (line 14)
0 Kudos
16 Replies
derekswingley1
Deactivated User
I agree that is one approach, depends how easy/quick it is for the OP to snap off just the bit that's causing issues, always worth having other approaches.  To return that one dojo uncompressed file (for many people) means changing one line in the handler that returns it, IMO that's not a hardship.

Not everyone is aware of all the options.


The reason I recommended an alternative approach is that in ~4 years of developing with the API, I cannot recall a single instance of solving a problem by using uncompressed vs. compressed Dojo source files. Is that how you're set up locally? To me, suggesting this approach seems like a rabbit hole that could easily be avoided by following the normal web dev approach of eliminating complexity to create a simple repro case, sharing that with the community and asking for help.
0 Kudos
__Rich_
Deactivated User
The reason I recommended an alternative approach is that in ~4 years of developing with the API, I cannot recall a single instance of solving a problem by using uncompressed vs. compressed Dojo source files. Is that how you're set up locally? To me, suggesting this approach seems like a rabbit hole that could easily be avoided by following the normal web dev approach of eliminating complexity to create a simple repro case, sharing that with the community and asking for help.

My setup and how I adjust it are based on the scenario I find myself in day to day, horses for courses, being adaptable and having the tools/knowledge to solve problems in the most appropriate way for the situation at hand, I find is a plus.

I think this conversation is muddying this thread, feel free to PM me if you like...
0 Kudos
derekswingley1
Deactivated User

I think this conversation is muddying this thread


Agreed. Apologies to OP for highjacking the thread. Still hoping to see a simple repro case.
0 Kudos
StephenLead
Honored Contributor
We are attempting to implement a website based on the Kurogo framework, an open source webapp framework that includes a mapping module which interfaces with ArcGIS map services.  Very cool.  They provide a demo which uses a nice map of Boston


Can you point us to the original demo, too? I can't find it online.

Thanks
0 Kudos
JeffJacobson
Frequent Contributor
The first thing I would do is your JavaScript code* through either JSLint or JSHint to check for errors.

* If you are not writing JavaScirpt, but it is instead being generated by Kurogo, then run the generated JavaScript code through JSLint or JSHint.
0 Kudos
HugoAhlenius
Deactivated User
I got a similar error - if I don't add a certain graphics layer to the map, then the print action works ok
0 Kudos
TyroneLigon
Deactivated User
I have a similar error using the 2.7 and 2.8 APIs; the error occurs when adding an image layer to the map.  However, while using Firebug, the call to connect to the image layer returns JSON from the server, and it looks correct. Can't figure out what's causing the error.
0 Kudos