Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The following quickie command line application formats a list of questions obtained from search results.


Perl, JSON


  1. Retrieve a list of questions from the API (from the /questions/{ids} or /search route, maybe others) into one or more JSON file.
  2. Call the script on the JSON file(s).
  3. Copy-paste the output into a post on meta.*.


wget -O list+recommendations-1.json ';recommendations'
wget -O list+recommendations-2.json ';recommendations&page=2'
wget -O list+recommendations-3.json ';recommendations&page=3'
show_questions list+recommendations-?.json

Result: this meta.scifi question, e.g.

The script:

#! /usr/bin/env perl

## Usage: $0 questions.json ...

use strict;
use warnings;
use File::Slurp qw(slurp);
use JSON;

my $root = $ARGV[0]; shift; $root =~ s!/$!!;

my @questions =
  sort {$a->{question_id} <=> $b->{question_id}}
  map {@{$_->{questions}}}
  map {from_json(slurp($_))} @ARGV;

foreach my $q (@questions) {
    my $title = $q->{title}; $title =~ s/([*<>\[\]\`\\])/\\$1/g;
    my $url = "$root/questions/" . $q->{question_id};
    my $answers = $q->{answer_count};
    print "* [$title]($url) ($answers)\n";
share|improve this question
+1 - I sure could have used this script here. – Nathan Osman Feb 28 '11 at 20:10

You must log in to answer this question.

Browse other questions tagged .