更新时间:2023-01-17 17:14:17
从您提供的JSON, locations
是一个数组括号意味着),因此从 valueForKey:
返回的值包含在NSArray实例中(因此包含在括号中)。
From the JSON you provided, locations
is an array (that's what the square brackets mean), so the values that are returned from valueForKey:
are contained in NSArray instances (hence the parentheses).
您可以在最后调用 valueForKey:
之前使用 objectAtIndex:
,以获取您要查找的值。
You could use objectAtIndex:
before the last call to valueForKey:
to obtain just the value you're looking for.
顺便说一下,您也可以使用 valueForKeyPath:
来简化访问嵌套值,例如
By the way, you can also use valueForKeyPath:
to simplify accessing nested values, for example
[deal valueForKeyPath:@"business.name"];