Skip to content

Instantly share code, notes, and snippets.

@ledlogic
Created February 27, 2016 00:47
Show Gist options
  • Select an option

  • Save ledlogic/761a3c1e5e7723a9c08d to your computer and use it in GitHub Desktop.

Select an option

Save ledlogic/761a3c1e5e7723a9c08d to your computer and use it in GitHub Desktop.

Revisions

  1. ledlogic created this gist Feb 27, 2016.
    15 changes: 15 additions & 0 deletions har2csv.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/usr/bin/ruby
    require 'rubygems'
    require 'json'
    require 'csv'

    infile = ARGV[0]
    json = File.read(infile)
    parsed = JSON.parse(json.encode("UTF-8"))

    outfile = ARGV[1]
    CSV.open(outfile, "wb") do |csv|
    parsed["log"]["entries"].each do |entry|
    csv << [entry["request"]["url"]]
    end
    end