Skip to content

Instantly share code, notes, and snippets.

@glimchb
Last active May 29, 2025 17:51
Show Gist options
  • Save glimchb/8b1b00e371a43a40e7dd7339ec0e9643 to your computer and use it in GitHub Desktop.
Save glimchb/8b1b00e371a43a40e7dd7339ec0e9643 to your computer and use it in GitHub Desktop.
SPDK doc/jsonrpc.md linter of json examples
###################################################
import re
with open("doc/jsonrpc.md", "r") as file:
data = file.read()
examples = re.findall("~~~json(.+?)~~~", data, re.MULTILINE | re.DOTALL)
for example in examples:
try:
json.loads(example)
except json.decoder.JSONDecodeError:
for i, x in enumerate(example.splitlines()):
print(i+2,x)
raise
###################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment