Skip to content

Commit

Permalink
yaml-to-json converter
Browse files Browse the repository at this point in the history
  • Loading branch information
Myles Byrne committed Sep 18, 2014
1 parent cf11fa0 commit ae5b937
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/yaml-to-json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

set -e

# ensure we're in the parent directory of this file
cd $(dirname $0)/..

# feed in some yaml
./yaml-to-json <<YAML
key:
subkey:
- first element
- second element
YAML
9 changes: 9 additions & 0 deletions yaml-to-json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env ruby

# Converts yaml formatted input (on stdin) to json formatted output (on stdout)

require 'yaml'
require 'json'

map = YAML.load(STDIN.read)
puts JSON.dump(map)

0 comments on commit ae5b937

Please sign in to comment.