Imagine you are building a proxy (edge layer) application API endpoint which receives a JSON payload. But you don’t know the structure of this payload.
Write a function which extracts values from all JSON fields which has a type of "string" and returns them as an array of strings.
这道 Apple OA 题的核心是遍历未知结构的 JSON 数据,并筛选出所有类型为 string 的字段值,最后按数组返回。解题时通常需要递归处理嵌套对象和数组,遇到普通字符串就收集,遇到对象或数组继续向下搜索。重点在于正确 JSON 的层级结构、避免漏掉深层字段,并保证返回结果只包含字符串值。
正文完