Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
02/18/14 09:09 PM (11 years ago)

JSON error

I am receiving an error on my simulator stating "The JSON data for this app is invalid. Restart your app to try again". I haven't changed anything so I don't know where this is coming from. I took it to a JSON validator and the results were a parse error but I'm not seeing an error. All the T's are crossed and commas in place.
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
02/18/14 09:27 PM (11 years ago)
Send it to me in a text file or paste into an clipboard site
 
Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
like
02/18/14 10:10 PM (11 years ago)
Sent in a PM.
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
02/19/14 12:29 AM (11 years ago)
The error reported by http://jsonlint.com is: Parse error on line 511: ... , -----------------------^ Expecting 'STRING' { "itemId": "FFB2B38C3023AFF927C73F2", "itemType": "BTA_design_menu", "itemNickname": "Recipes", "navBarTitleText": "Recipes", "childItems": [ ] }, { "itemId": "C785FD4B891429E245F3E9D", "itemType": "BTA_design_menu", 511 "itemNickname": "Main Menu One", 512 , "childItems": [
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
02/19/14 12:37 AM (11 years ago)
Notice that line 512 has only a comma. That block of JSON is for itemType of "BTA_design_menu" for the screen with a nickname of "Main Menu One"". It has these lines in it: - itemId - itemType - itemNickname - - childItems Looking at the prior block of JSON, we see another itemType of "BTA_design_menu". However, that error-free block has one more line than the error block. It has these lines: - itemId - itemType - itemNickname - navBarTitleText - childItems Please check the screen named "Main Menu One". See if you have defined a value for the Navbar Title Text in that screen. It might be blank. Who says I can't do work on iPad?! :-) -- Niraj
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
02/19/14 12:44 AM (11 years ago)
Also, your quantity of JSON is quite a lot -- over 3400 lines! For a screen or set of screens, break it's JSON into their own data files. Use the dataURL setting for that screen to point to the JSON Data File residing in the Files Section of your Server. Each data file would contain the childItems for that particular screen. By reducing the quantity of JSON data in a single file, the CPU will not be overloaded, which leads to faster start-up times for the app and it will be a more responsive mobile app. -- Niraj
 
Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
like
02/19/14 02:18 AM (11 years ago)
I just breathed a sigh of relief. BTW - working on an iPad should be considered rockstar status. Looking at my control panel, all the data I entered for that menu had disappeared and I have no answer to where it went. I reentered it and in the end, I ended up having to manually add the "navBarTitleText" "main menu" in the config file. I was laughing at the "over 3,400 lines!" Is this data URL setting as simple as just clicking on the "connect to control panel" button or is there more I need to look into? Thank you so, so much :))
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
02/19/14 07:28 AM (11 years ago)
If you truly updated the config file by hand your change will be erased, the next time you "Prepare Project for Download" or the next time you hit the "refresh arrow" in the app. Try deleting that screen, then make a new version of it. Re-connect it's Parent and it's Children. That way you will remain safe. The dataURL approach can work if you are comfortable with JSON. Typically your type of content is best managed in a server database and delivered on-demand to the app. First, try the app on an actual device. Observe the startup time and the screen to screen delays. If it is tolerable, then leave it alone. In the meanwhile, start thinking about using semi-manual JSON files or a full-on database. -- Niraj
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.