I have an object that looks like this:
var obj = {
"array1": [
{
"label": "something1",
"ref": "option2a"
},
{
"label": "something2",
"ref": "option2b"
},
{
"label": "something3",
"ref": "option2a"
},
{
"label": "something4",
"ref": "option2a"
},
{
"label": "something5",
"ref": "option2a"
}
],
"array2": [
{
"label": "something6 is the longest label",
"ref": "option3a"
},
{
"label": "Other",
"ref": "option3b"
}
]
}
I want to get the length of the longest label. In this case I would want to return 17. Because the longest label is "somethinglongest" which has a length of 17.