The Emperor's New Clothes

Imagine a world where Bash supports JSON.

You are traveling through another dimension, a dimension not only of sight and sound but of mind. A journey into a wondrous land of imagination:

#!/bin/bash
. ticktick.sh

``
  people = {
    "Writers": [
      "Rod Serling",
      "Charles Beaumont",
      "Richard Matheson"
    ],
    "Cast": {
      "Rod Serling": { "Episodes": 156 },
      "Martin Landau": { "Episodes": 2 },
      "William Shatner": { "Episodes": 2 }
    }
  }
``

function printDirectors() {
  echo "  The ``people.Directors.length()`` Directors are:"

  for director in ``people.Directors.items()``; do
    printf "    - %s\n" ${!director}
  done
}

`` people.Directors = [ "John Brahm", "Douglas Heyes" ] ``
printDirectors

newDirector="Lamont Johnson"
`` people.Directors.push($newDirector) ``
printDirectors

echo "Shifted: "``people.Directors.shift()``
printDirectors

echo "Popped: "``people.Directors.pop()``
printDirectors

Utilizing a run-time JSON parsing engine written in Bash called TickTick... look, that's the signpost up ahead - your next stop, GitHub.

Its name is TickTick, go get it now.


For comments and questions go to reddit or HN.