<div dir="ltr">oh i see, sorry for that.  i should probably read the whole thing before replying</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 28, 2014 at 1:44 PM, Rick Westerman <span dir="ltr"><<a href="mailto:westerman@purdue.edu" target="_blank">westerman@purdue.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Of course it is syntactically correct.  But it is logically wrong.  What we should do to help out poor old Derrick is to read in the file, correct it logically, and write it back out.  That is the challenge.<br>

<div class="HOEnZb"><div class="h5"><br>
----- Original Message -----<br>
> maybe i am missing something, but, according to <a href="http://jsonlint.com/" target="_blank">http://jsonlint.com/</a> ,<br>
> <a href="http://www.csociety.org/~kearneyd/tmp/purduepm_json_challenge_1.json" target="_blank">http://www.csociety.org/~kearneyd/tmp/purduepm_json_challenge_1.json</a><br>
> is valid json ...<br>
><br>
><br>
><br>
> On Mon, Apr 28, 2014 at 1:35 PM, derrick < <a href="mailto:derrick@csociety.org">derrick@csociety.org</a> ><br>
> wrote:<br>
><br>
><br>
> Wow, I think I really messed this one up!<br>
><br>
> I was working on the first part of the challenge problem this weekend<br>
> and had a huge brain fart. I need your help to getting this sample<br>
> json file cleaned up.<br>
><br>
> In our last meeting we learned about the JSON file format. I created<br>
> the sample json file I wanted to use for the first part of the<br>
> challenge, but I accidentally mixed up some of values while I was<br>
> writing the file. To make things worst, my favorite text editor<br>
> mysteriously now opens json files in read only mode, so I can't just<br>
> go in and fix it by hand (ugh, technology).<br>
><br>
> I uploaded the file here:<br>
> <a href="http://www.csociety.org/~" target="_blank">http://www.csociety.org/~</a> kearneyd/tmp/purduepm_json_ challenge_1.json<br>
><br>
> While I sort things out with my system, if you have a bit of extra<br>
> time, can you write a program that will do the following:<br>
><br>
> 1) Read and Parse the JSON file.<br>
><br>
> Read the json file into memory and parse it into data structures that<br>
> best fit the programming language you are using. There are 6 data<br>
> types you need to worry about:<br>
><br>
> Primitive Types:<br>
> * null<br>
> * booleans<br>
> * strings<br>
> * numbers<br>
><br>
> Structured Types:<br>
> * arrays<br>
> * objects<br>
><br>
> More information about the json file format can be found here:<br>
> <a href="http://json.org/" target="_blank">http://json.org/</a><br>
><br>
> The file represents a dictionary, or hash table, or associative array.<br>
><br>
> There is probably a library available in your programming language,<br>
> you can use to quickly read and parse the file. The <a href="http://json.org" target="_blank">json.org</a> website<br>
> has a list of some libraries for popular programming languages.<br>
><br>
> After parsing the file into your language's data structures, you<br>
> should print the values stored in the data structures to stdout or<br>
> another file to make sure you are reading the data properly. don't<br>
> just print the file after reading it.<br>
><br>
><br>
> 2) Fix the JSON file and write it back to disk.<br>
><br>
> Here is where it gets tricky. Even though the json file was<br>
> syntactically correct, I made some mistakes in the data that is stored<br>
> in it. Here is a summary of what I wanted for each key in the<br>
> dictionary :<br>
><br>
> * null_value should be a json NULL or None value, not a string.<br>
> * boolean_true should be a json true value, not false<br>
> * boolean_false should be a json false value, not true<br>
> * integer_number should be the integer representation of its current<br>
> value, not the floating point representation (ie 3)<br>
> * number_examples -> "not a number" should not even be in the<br>
> dictionary, lets remove it.<br>
> * in "array", the string "value5" should read "value4" to match "key4"<br>
><br>
> Can you write a program to make these specific changes? Don't forget<br>
> to comment your code. If you find an interesting way of addressing<br>
> elements inside of the structure, please highlight that in your code.<br>
> For example, how would you find the value for "key4" in the file? If<br>
> there were multiple dictionary keys named "key4" in the file, how<br>
> could you make sure you were addressing the correct one?<br>
><br>
> The data in the outputted file should look something like like this:<br>
><br>
> {<br>
> "null_value": null,<br>
> "boolean_true": true,<br>
> "boolean_false": false,<br>
> "string": "this is my string.",<br>
> "integer_number": 3,<br>
> "number_examples": {<br>
> "positive integer": 9,<br>
> "negative integer": -1,<br>
> "float": 2.3,<br>
> "positive_exponent": 4.35e+58,<br>
> "negative_exponent": 4.3508e-93<br>
> },<br>
> "array": [true,null,["value3"],{"key4": "value4"}]<br>
> }<br>
><br>
><br>
> Note that the order of the keys (null_value, boolean_true,<br>
> boolean_false, ...) does not matter since the pairs of a json object<br>
> are unordered.<br>
><br>
><br>
> We'll discuss how to perform these actions in the different<br>
> programming languages people chose to use in the next meeting on May<br>
> 20, 2014.<br>
><br>
> Thanks,<br>
><br>
> dsk<br>
><br>
><br>
><br>
> On 04/15/2014 02:30 PM, Mark Senn wrote:<br>
><br>
><br>
><br>
><br>
> Derrick Kearney is going to prepare some JSON and the following people<br>
> will talk and/or write about how they read it with the following<br>
> programming languages before or at the Purdue Perl Mongers meeting on<br>
> May 20, 2014. Send email to <a href="mailto:markiest@purdue.edu">markiest@purdue.edu</a> (remove "iest" from<br>
> the email address) with any corrections or additions to the below<br>
> list.<br>
><br>
> LANGUAGE WHO<br>
> Mathematica Mark Senn<br>
> Perl Dave Jacoby<br>
> PHP Chris Orr<br>
> pro Mark Senn<br>
> Python Joe Kline<br>
> Ruby Rick Westerman<br>
><br>
> Mark Senn, Systems Programmer, Engineering Computer Network, Purdue<br>
> University<br>
><br>
> ______________________________ _________________<br>
> Purdue-pm mailing list<br>
> <a href="mailto:Purdue-pm@pm.org">Purdue-pm@pm.org</a><br>
> <a href="http://mail.pm.org/mailman/" target="_blank">http://mail.pm.org/mailman/</a> listinfo/purdue-pm<br>
><br>
><br>
> _______________________________________________<br>
> Purdue-pm mailing list<br>
> <a href="mailto:Purdue-pm@pm.org">Purdue-pm@pm.org</a><br>
> <a href="http://mail.pm.org/mailman/listinfo/purdue-pm" target="_blank">http://mail.pm.org/mailman/listinfo/purdue-pm</a><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Rick Westerman<br>
<a href="mailto:westerman@purdue.edu">westerman@purdue.edu</a><br>
<br>
Bioinformatics specialist at the Genomics Facility.<br>
Phone: <a href="tel:%28765%29%20494-0505" value="+17654940505">(765) 494-0505</a>           FAX: <a href="tel:%28765%29%20496-7255" value="+17654967255">(765) 496-7255</a><br>
Department of Horticulture and Landscape Architecture<br>
625 Agriculture Mall Drive<br>
West Lafayette, IN 47907-2010<br>
Physically located in room S049, WSLR building<br>
</font></span></blockquote></div><br></div>