News for hackers. Stuff that matters.
Re:JSON River – Parse JSON incrementally as it streams in by cozzyd on Monday October 13, 2025 @01:05PM (#45570752)
incomplete strings could be fun in certain cases

{"cleanup_cmd":"rm -rf /home/foo/.tmp" }

Re:JSON River – Parse JSON incrementally as it streams in by stronglikedan on Monday October 13, 2025 @02:35PM (#45571804)
If any part of that value actually made it, unchecked, to execution, then you have bigger problems than partial JSON keys/values.
Re:JSON River – Parse JSON incrementally as it streams in by rictic on Monday October 13, 2025 @01:21PM (#45570934)
Yeah, another fun one is string enums. Could tread "DeleteIfEmpty" as "Delete".
Re:JSON River – Parse JSON incrementally as it streams in by Waterluvian on Monday October 13, 2025 @01:55PM (#45571354)
I imagine if you reason about incomplete strings as a sort of “unparsed data” where you might store or transport or render it raw (like a string version of printing response.data instead of response.json()), but not act on it (compare, concat, etc), it’s a reasonably safe model?

I’m imagining it in my mental model as being typed “unknown”. Anything that prevents accidental use as if it were a whole string… I imagine a more complex type with an “isComplete” flag of sorts would be more powerful but a bit of a blunderbuss.

Re:JSON River – Parse JSON incrementally as it streams in by sublee on Monday October 13, 2025 @08:33PM (#45574900)
Incremental JSON parsing is key for LLM apps, but safe progressive UIs also need to track incompleteness and per-chunk diffs. LangDiff [1] would help with that.

[1]: https://github.com/globalaiplatform/langdiff/tree/main/ts

Re:JSON River – Parse JSON incrementally as it streams in by cozzyd on Tuesday October 14, 2025 @08:59AM (#45579517)
Why not just chunk the json packets instead?
Re:JSON River – Parse JSON incrementally as it streams in by xg15 on Tuesday October 14, 2025 @02:19AM (#45576833)
Only because you have access to the incomplete value doesn't mean you should treat it like the complete one...