more carefully parse json