added null checking in json