added php logic for empty json objects