Skip to content

Instantly share code, notes, and snippets.

@sonnyksimon
Last active June 20, 2022 16:39
Show Gist options
  • Save sonnyksimon/d23fa2c51402592f4048f09c1fa4d9c7 to your computer and use it in GitHub Desktop.
Save sonnyksimon/d23fa2c51402592f4048f09c1fa4d9c7 to your computer and use it in GitHub Desktop.
Python JQ in windows
import subprocess
import json
def applyjqtxt(filter, text):
echo = subprocess.Popen(('echo', text), stdout=subprocess.PIPE)
output = subprocess.check_output(('jq', filter), stdin=echo.stdout)
echo.wait()
return output
def applyjq(filter, data):
text = json.dumps(data)
output = applyjqtxt(filter, text)
return json.loads(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment