I needed a break in a long code merging session, so I improved the Penn State’s Amazing Race by separating its code and data, so faculty can now easily change the question set for their specific use. I also fixed a few things so now it can run on any local machines (note that Google Earth still requires internet access to read its earth data).
What I did was extract the section of the hard-coded questions, replace that with a synchronous Ajax call to read in a JSON data set, so now all the questions are laid out in a separate text file, with JSON format. JSON is a simple and clean format for both users and coders.
I learned a few things that are not apparent in any documents I found:
1. JSON does not support comments, so the compromise is to use a variable called “_comment”. I use an array to include multi-line comments.
2. JSON does not support raw TAB in its data, i.e. within the quotation marks, there should not be any TABs. I replaced them with spelled out spaces.