changed implementation to use JSON parser