Loving JSON

For the last few months, I’ve been working on the DALN Project, a collection of literacy narratives by just regular people like you and me. Actually, I’m on there. Points to someone who can find my embarrassing freshman self on there.

Anyways, coding for the DALN has been an ongoing project even before I was assigned. One of our other SIFs, Shakib Ahmed, was in the process of coding the backend since last summer and he’s done a pretty good job by creating an API (Application Program Interface) that I can use in my own frontend side. Basically every time I need something from the API, I just browse to it like any other URL and it returns something like this:


[{"description":"Awesome DALN narrative","identifierUri":"http://hdl.handle.net/2374.DALN/123","dateAccessioned":"2009-05-28T15:44:25Z","dateAvailable":"2009-05-28T15:44:25Z","dateCreated":"2009-05-03","dateIssued":"2009-05-28T15:44:25Z","rightsConsent":"adult","rightsRelease":"adult","contributorAuthor":["Dude, Guy"],"creatorGender":["Female"],"creatorYearOfBirth":["1976"],"coveragePeriod":["2000-2009"],"coverageNationality":["U.S. citizen"],"subject":["dude","that's","just","like","your","opinion","man"],"assetList":[{"Asset Type":"Audio/Video","Asset ID":"1212312-12321-31-3-2-21-3","Asset Description":"Literacy Narrative","Asset Location":"https://mwharker.vids.io/videos/duuude","Asset Name":"dude.mov"}],"postId":"223423423423","title":"DUUUUDEEE"}]

Which is a JSON callback. Basically, it’s a mix of JSON objects which name-value pairs that you can use in coding. For example, storing the above code in a variable like var data allows for us to access each name pair and get the data from it. so console.log(data.description) would return a String Awesome DALN narrative, at least in Javascript. It is a pretty cool representation of data even though it just looks like a text file with some commas. And one of the great things about it is that JSON can be what’s called language agnostic , meaning that you can use Javascript, Scala, Groovy, Perl, PHP, or whatever language you want. This makes it easy to make additional applications with the same data. Very useful in today’s multiplatform world.

JSON is so flexible that you can even use it in game design. Whenever a game saves, you want to save a lot of data and compress it so that the next time the game loads up, you will have all the things in the right places or at least the last checkpoint of wherever the player was. For our name and value pairs we could put things like player_location, enemy_locations, power_up_enabled into a JSON object to store for later and use a library like fullserializer to read it back into Unity.

I hope that we will be able to use JSON in the upcoming 3D Atlanta project. The dream is that a person would be able to go to a web site, pick their historic area of interest and be able to configure their own game environment using options they selected, so JSON will work with that as holding the values for Unity to build an environment on. Thanks to DALN, I know a ton more about it and hope to utilize the full extent of JSON in the future for other projects I create.

Leave a Reply

Your email address will not be published. Required fields are marked *