how to count length of the JSON array element
First if the object you're dealing with is a string then you need to parse it then figure out the length of the keys :
obj = JSON.parse(jsonString);
shareInfoLen = Object.keys(obj.shareInfo[0]).length;
Before going to answer read this Documentation once. Then you clearly understand the answer.
Try this It may work for you.
Object.keys(data.shareInfo[i]).length