Rework the ParseJsonBuffer function to get one chunk at a time.

The "find how many iovec entries we need" feature of ```evbuffer_peek``` was not always there, so with older versions of libevent, this code does not work properly.
Move this inside the body of the if ?