- Objective: To implement a
GroceryReporter
capable of parsingJerkSON
and formatting to a string - Purpose: To gain familiarity with regex and payload parsing
In this project you will find a file in the resource
directory named RawInput.JerkSON
.
It was supposed to be a grocery list formated in JSON
. However, Tariq, your fearless yet petty leader decided to come reformat it in his own Object Notation. JerkSON
... you are welcome.
- In
JSON
,- keys are encapsulated by quotes
- values are encapsulated by quotes (unless numeric)
- key and value are seperated by a colon.
- key and value pairs are seperated by a comma.
{
"name" : "Milk",
"price" : 3.25,
"type" : "food",
"expiration" : "01/24/2016"
}
- Just like
JSON
,JerkSON
is a key-value-pair-data-store. - In
JerkSON
,- key and value are seperated by any of the following (
:
,@
,^
,*
,%
) - key and value pairs are seperated by a
;
. - objects are separated by
##
- key and value are seperated by any of the following (
NaMe:egGS;[email protected];typE^foOd;eXPiRAtIOn%1/24/2016##
All string manipulation should be achieved through regex to detect and match patterns. Its not guranteed that every Key will have a Value, and every Value will have a pair. For instance:
you may see something like this
Name:Milk;Price:3.23;type:;expiration:1/24/2016##
Notice how TYPE has a key but no Value.... if you try and parse this into an object your program could crash. You will need to handle your exceptions! I also expect you to report on how many exceptions you saw while parsing the data. GOOD LUCK ZIPCODERS!!!! May the Odds be ever in your favor!!!!