Skip to content

Instantly share code, notes, and snippets.

@vergenzt
Last active November 12, 2019 06:37
Show Gist options
  • Save vergenzt/4d1b9ce1d74d98d8cfd39deac889c5af to your computer and use it in GitHub Desktop.
Save vergenzt/4d1b9ce1d74d98d8cfd39deac889c5af to your computer and use it in GitHub Desktop.
  1. Export data
  2. Unzip
  3. cd facebook-<username>
  4. find . -type f -name '*.json' | xargs -n1 jq -c '. as $input | {} | setpath(input_filename / "/"; $input)'

=> This'll get you to a one-file-per-line stream of JSON objects formatted with the filepath (relative to the export root) as the nested JSON object path. So e.g. a file at ./ads/ad_interests.json containing JSON content:

{
  "topics": [
    "Facebook Messenger",
    "Instant messaging",
    "Reddit",
    "Social network"
  ]
}

Would end up like:

{".":{"ads":{"ads_interests.json":{"topics":["Facebook Messenger","Instant messaging","Reddit","Social network"]}}}}

Next step is to merge into a single JSON blob, and then use a JSON Schema generator tool to explore the structure and turn into a Singer tap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment