Yes, now I see why my idea won’t work. Though just cranking up buffer size to a higher value will only delay inevitable - when message is again bigger than that.
I also saw that there is probably a typo there - second line missing comma in the end:
json = ast_json_pack("{s: s, s: s, "
"s: {s: i, s: s} "
"s: {s: {s: s, s: s, s: i}, "
"s: s, s: s} }",