Fix bug when reading json objects