Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 9    Views: 133

ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
10/28/12 11:38 PM (13 years ago)

Android Quiz bug? Or my 'not' so good friend json?

Hello BT'ers, I am having some Android json parsing issues with an app I've already developed for iOS using a self-hosted BT v2 server. It has over 100 questions in four quizzes and the Quiz Data was generated by @Stobe's "Quiz Tool Maker" and hosted as a "Screen Data URL". Everything works fine for this app... https://itunes.apple.com/au/app/collingwood-football-club/id546941425?mt=8 One of the data URL's for one of the quizzes is here: http://webplusapps.com/apps/cfctrivia/QuizModernData.txt However, when I use the same data URL's for my separate Android app I get json parsing errors. I assumed the json was valid because it works for the iOS app without issues. However, after running the data through jsonlint.com it complains that there is an error at line 12 where the next child item starts. I assume this is because they are the "child items" and not the complete json from the app? Thoughts? The error I get from logcat is : "Unterminated array at character 285" (About the end of line 12 I'd guess!) Full log is here: http://pastebin.com/HWUwti1c Any ideas of what's wrong would be great! I'm was thinking an Android plugin bug but the json not validating has me confused... especially since the iOS version runs :(
 
Walms
Code is Art
Profile
Posts: 235
Reg: Aug 24, 2011
Derby
3,300
like
10/29/12 05:13 AM (13 years ago)
check for any invalid characters. Ive not gone through your entire log but I did notice: ""questionText":"Heritier 'Harry' O'Brien is the first Brazilian-born AFL player?", json will not like '' in question text, try removing these and try again.
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
10/29/12 05:52 AM (13 years ago)
@Walms Thanks a lot - great suggetsion! I've had that issue with screen names having apostrophe's before and invalid config data. It's 12 midnight here so I'll tackle it tomorrow. Thanks again for the suggestion. Interesting that it doesn't effect the iOS app parsing the same data. I'll report back. Cheers
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
10/29/12 07:07 AM (13 years ago)
the apostophie or lack of any characters has caused me a few headaches with JSON. I was wondering if there was a control code to use for that in JSON... and are you using true/false on that quiz? very cool. keep meaning to try that mod!
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
10/29/12 08:40 AM (13 years ago)
looks like there are no commas between your question items.
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
10/29/12 05:28 PM (13 years ago)
Thanks for all the suggestions and here's the update .. Stobe nailed it ... add a comma between the items and all works again! @Walms it wasn't the apostrophe in O'Brien. Perhaps this is because the items are wrapped in full quotation marks "" ? @Atrain53 Yes I am using the true/false mod. Only problem is that on BTv2 the true false questions have extra empty slots that can be clicked (still got approved by Apple though!) See example here: https://www.evernote.com/shard/s2/sh/0e0aa7ce-a9d2-410c-ad8e-96a0eee67b39/e328b677ef02c689c9f313d03991422f @Stobe Thanks for solving this one :) The data was generated from a csv file using your quiz tool (Money well spent BTW!) The iOS app is happy without commas between child items but the Android does not. You may want to update or let users know. Cheers Darrel
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
10/29/12 05:33 PM (13 years ago)
Good to know. I'll have to look at my files, since I thought it was putting commas between items. Check your version of the quiz tool and let me know what it is.
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
10/29/12 10:46 PM (13 years ago)
I'll let you know what version I have as soon as I can get to my other desktop and fire up the virtual machine.
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
11/01/12 02:25 AM (13 years ago)
Hi All, Just to finish off this thread ... I was running version 1.2 of the quiz tool but the 'About Menu' suggest version 1.1. <a href="https://www.dropbox.com/s/noqsvn9zt87uwj6/quizmaker.jpg" target="_blank" rel="nofollow">https://www.dropbox.com/s/noqsvn9zt87uwj6/quizmaker.jpg</a> A simple find }{ and replace },{ on the json data solved the Android issue. Thanks for all of your input. Much appreciated. Darrel
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
11/01/12 03:04 AM (13 years ago)
Oops :). I always forget to update those pesky "about" screens. I can add the comma into the next update to the quiz tool. Thanks for finding that, @ictguy!
 

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.