Skip to content

Instantly share code, notes, and snippets.

View xamebax's full-sized avatar
🐢

Marta Paciorkowska xamebax

🐢
View GitHub Profile
@xamebax
xamebax / json2path.py
Last active December 23, 2015 06:39 — forked from mpasternacki/json2path.py
#!/usr/bin/env python
import json
import sys
def pp(vv, prefix='$'): # vv = array w/ JSON data, prefix = what's printed at the start of each line
if isinstance(vv, (list,tuple)): # if vv is a list/tuple - an Array in Ruby
for i, v in enumerate(vv): # vv being enumerated means each array element
# is being given an "index", so (a, b, c) => [(0, a), (1, b), (2, c)]...
# so for each "index" & "value" pair of the enumerated vv array...