improved json parser