Two minor bugs corrected

Hi,

Thanks a lot for your function. When including it in https://github.com/sergiosgc/ZeroMass-Plugins/blob/master/com.sergiosgc.db.php I found two minor bugs that these two commits fix: 

1. You silently die, in the middle of the function. It got me scratching my head for a while, because your array parser function barfed on strings which ended with an escaped double quote (e.g. {"\"I am a quoted string\""}. I replaced the die with an exception throw, which is noisier on debug environments
2. I fixed the off by one bug that caused the error. The off by one is caused by the two increments on search, one in line 62 and the other on line 64. I removed the one on line 64.

Feel free to pull this code into your repo. I don't have a need for the fork of your code, so I'll delete the fork once I get the notification that this pull request is pulled (or rejected).

Kind regards,

--
Sérgio Carvalho