implementation of the JSON parser