Skip to content

Instantly share code, notes, and snippets.

@amundo
Created July 12, 2013 18:56
Show Gist options
  • Select an option

  • Save amundo/5986840 to your computer and use it in GitHub Desktop.

Select an option

Save amundo/5986840 to your computer and use it in GitHub Desktop.
import json
data = {"nodes":[{"nodename":"foo"},{"nodename":"bar"}]}
print json.dumps(data)
nodes = data["nodes"]
nodes.sort(key=lambda node: node['nodename'])
data["nodes"] = nodes
print json.dumps(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment