I have a JSON string which I was able to scrape from a website. I only needed the following data (the original string is much longer) Here is the retrieved JSON which I am planning to convert into a Ruby Hash:
{"day": 15, "month": 03, "year": 2012, "hour": 10, "min": 00, "sec": 00}
I retrieved the above json by using the regex:
targetDate:\s+(.*?)}\)/m
I am not able to parse the above json because of the extra zeroes in the integers. (00 and 03) I tried changing the numbers manually using 3 instead of 03 and 0 instead of 00 and it worked!
So, I guess that the json parser may not be able to look at that kind of number.
The question is, how do I clean the retrieved JSON above so as to remove the unnecessary zeroes. That is,
{"day": 15, "month": 3, "year": 2012, "hour": 10, "min": 0, "sec": 0}
Thanks for all the help!