the last separator was not removed

the last ',' was not being removed. changed from sdata.length to checking for a empty object instead.