Skip to content

Flattenning complex nested json #4749

Closed Answered by mariosasko
Bing-su asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! .flatten only works with the dictionary feature type ({...}) or Sequence({...}), which is treated as a dictionary of sequences (e.g. Sequence({"a": Value("bool"), "b": Value("string")}) -> {"a": Sequence(Value("bool")), "b": Sequence(Value("string"))}) for consistency with TFDS, so you'll have to use map for flattening in this case. Perhaps the docs should explain more clearly what can be flattened and what can't.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Bing-su
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants