How can one sample's JSON label array become multiple rows?
json_each enumerates immediate children. For arrays its key is the zero-based position.
SQLite example and interpretation
Two labels yield two rows. Keep the key to reconstruct order. Nested arrays remain one item at this level, so deeper walks require recursion.
SELECT key,value FROM json_each('["train","verified"]') ORDER BY key;Result [[0, "train"], [1, "verified"]]
中文
如何把一条样本的 JSON 标签数组展开成多行?
json_each 枚举顶层容器的直接子项。对数组,key 给出从零开始的位置。
SQLite 示例与适用条件
两个标签产生两行,可用 key 保留原顺序。遇到嵌套数组,它只展开一层,需要递归遍历时使用另一种接口。
SELECT key,value FROM json_each('["train","verified"]') ORDER BY key;结果 [[0, "train"], [1, "verified"]]