Skip to content

Instantly share code, notes, and snippets.

@Eckankar
Created August 24, 2019 17:02
Show Gist options
  • Save Eckankar/ed9f4a555f663c768fb4db950f6156dc to your computer and use it in GitHub Desktop.
Save Eckankar/ed9f4a555f663c768fb4db950f6156dc to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use 5.026;
use warnings;
use List::Util qw(uniq);
use JSON;
# Extracts the likes, passes and matches from the Tinder JSON data, outputting it in CSV instead.
# To run it, go to https://tio.run/#perl5, paste in this code in the "Code" box, the content of your JSON file in the "Input" box, and click run.
# The output is then a semicolon-separated CSV you can import into Excel, Google Sheets or similar.
my $stdin = do { local $/; <STDIN> };
my $input = JSON::decode_json($stdin);
my @keys = qw(swipes_likes swipes_passes matches);
my @dates = sort { $a cmp $b } uniq( map { keys $input->{Usage}->{$_}->%* } @keys );
say join(";", 'date', @keys);
for my $date (@dates) {
say join(";", $date, map { $input->{Usage}->{$_}->{$date} } @keys);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment