Skip to content

flatten option for root keys to ignore keeps some data from the root keys #76

Description

@DebbieKat

I'm working with data returned from the twitter API for tweets, which returns data that is very nested for certain elements. One of these elements, the entities, contains annotations, hashtags, mentions and urls. I only care about the urls, so I passed the following statement:

        data = json_response['data']
        dict_flattened = (flatten(record, '.', root_keys_to_ignore={'mentions', 'hashtags', 'annotations'}) for record in data)

Doing so did remove some columns that were being returned, but I am still receiving data back from within those root keys. Am I just calling this incorrectly? Attaching output that was sent to a csv.

json_response_flatten.zip

Here is the output without specifying root keys to ignore:
json_response_flatten include all.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions