2 ms·
> a non-fragile format, e.g. json. JSON is a terrible format. Especially for streaming data. Here's a super simple shell script for generating invalid JSON th
by shakna 5y ago
> a non-fragile format, e.g. json.
JSON is a terrible format. Especially for streaming data.
Here's a super simple shell script for generating invalid JSON that will blow Python's stack:
n="$(python3 -c 'import math; import sys; sys.stdout.write(str(math.floor(sys.getrecursionlimit() - 4)))')"
left="$(yes [ | head -n "$n" | tr -d '\n')"
echo "$left" | python3 -c 'import json; print(json.loads(input()))'
It is invalid JSON. But you cannot tell if it's invalid until either:
a) You run out of memory.
b) The connection ends.
Because JSON is terrible for streaming data.