frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Binary Encodings for JSON and Variant

https://jincongho.com/posts/designing-binary-encodings-for-json-and-variant/
16•jincongho•3d ago

Comments

kstenerud•18h ago
As the author stated, it really depends on what you intend to use it for.

Fast internal scanning isn't free, because now you need pre-indexing, which is more data, and loses the incremental buildability on the encoding end.

Small transfer size and fast (full) decoding is possible with a single binary format, but unfortunately designers keep falling into the trap of adding extra things that make them incompatible with JSON. It's why I wrote https://github.com/kstenerud/bonjson/

boricj•18h ago
At work, I wrote a C++20 data binding library. It works by running visitors over a data model that binds to the application state. My comment comes from a different set of trade-offs driven by memory constraints.

I've implemented a bunch of serialization visitors. For the structured formats, most (JSON, YAML, CBOR with indefinite lengths) use an output iterator and can stream out one character/byte at a time, which is useful when your target is a MCU with 640 KiB of SRAM and you need to reply large REST API responses.

And there's the BSON serializer, which writes to a byte buffer because it uses tag-length-value and I need to backtrack in order to patch in the lengths after serializing the values. This means that the entire document needs to be written upfront before I can do something with it. It also has some annoying quirks, like array indices being strings in base 10.

There are also other trade-offs when dealing with JSON vs. its binary encodings. Strings in JSON may have escape characters that require parsing, if it has them then you can't return a view into the document, you need to allocate a string to hold the decoded value. Whereas in BSON or CBOR (excluding indefinite-length strings) the strings are not escaped and you can return a std::string_view straight from the document (and even a const char* for BSON, as it embeds a NUL character).

Some encodings like CBOR are also more expressive than JSON, allowing for example any value type to be used for map keys and not just strings.

jincongho•11h ago
Parquet file format writes its metadata including length info after all data, at the footer. It was counterintuitive when I first look at it, but smart thinking about it now. I haven't had to trade off for memory constraints, but being able to stream output is definitely easier!

Interesting point about the difference in escape characters, I stored length and the decoded value so it's ready for string view. But when I need them back as JSON string, I need to encode them again :)

GollyStream – Real-time Ethereum events at 1,265 ops/s with minipass

https://github.com/goodgollyholly/gollystream3
1•goodgollyholly•35s ago•0 comments

U.S. National Park Finder

https://nikag-ai.github.io/national-parks/
1•bookofjoe•4m ago•0 comments

Open-source DIY radar that's 95% cheaper than $250k commercial offerings

https://www.tomshardware.com/maker-stem/open-source-radar-system-is-95-percent-cheaper-than-usd25...
1•anjel•4m ago•0 comments

Show HN: Claude Code Rust – a native Rust TUI that avoids the V8 heap OOM

https://github.com/srothgan/claude-code-rust
1•char8•9m ago•0 comments

Reconstructing a Dead USB Protocol: From Unknown Chip to Working Implementation

https://github.com/coremaze/ME2-Writeup/blob/master/README.md
1•birdculture•11m ago•0 comments

In the UK, EVs are cheaper than petrol cars, thanks to Chinese competition

https://electrek.co/2026/04/18/in-the-uk-evs-are-cheaper-than-petrol-cars-thanks-to-chinese-compe...
2•breve•15m ago•0 comments

Crypto Hack Worth $290M Triggers DeFi Contagion Shock

https://www.bloomberg.com/news/articles/2026-04-19/crypto-hack-worth-290-million-triggers-defi-co...
1•helsinkiandrew•19m ago•0 comments

The Work Runs on Different Maps

https://yusufaytas.com/the-work-runs-on-different-maps
10•yusufaytas•21m ago•0 comments

Memjar: Uncompromising, local-first second brain

https://github.com/m00dy/memjar
1•m00dy•24m ago•0 comments

Tim Davis – Probabilistic engineering and the 24-7 employee

https://www.timdavis.com/blog/probabilistic-engineering-and-the-24-7-employee
1•kiyanwang•27m ago•0 comments

2005 PS2 Game Returning with New Release on PS5, PS4

https://comicbook.com/gaming/news/ps2-playstation-2-games-ps5-ps4-release-2005/
1•01-_-•33m ago•0 comments

The framework built by a father in 2006 dominated the internet

https://comuniq.xyz/post?t=966
2•01-_-•34m ago•1 comments

An Amish Paradox: Diversity and Change in the Largest Amish Community

https://www.thepsmiths.com/p/review-an-amish-paradox-by-charles
1•barry-cotter•35m ago•0 comments

LlaMa.cpp Robot Wars

https://www.youtube.com/watch?v=bgZ3pmr0DIs
4•Pasyd•35m ago•1 comments

Performance • tldraw Docs

https://tldraw.dev/sdk-features/performance
2•aragonite•35m ago•0 comments

Ask HN: Is your Mac's menu bar throwing errors?

1•vsgherzi•36m ago•0 comments

SitTall – a macOS app that uses AirPods sensors to detect slouching

https://sittall.app/
1•anilatici•38m ago•1 comments

Anatomy of High-Performance Matrix Multiplication (2008) [pdf]

https://www.cs.utexas.edu/~flame/pubs/GotoTOMS_revision.pdf
2•tosh•40m ago•0 comments

Visual Studio Code Agents App (Preview)

https://code.visualstudio.com/updates/v1_115#_visual-studio-code-agents-preview
2•maxloh•50m ago•0 comments

Hero Engineering: In Defense of Unreasonable Optimizations

https://deancalver.substack.com/p/hero-engineering-in-defense-of-unreasonable
2•DeanoC•55m ago•0 comments

Edit store price tags using Flipper Zero

https://github.com/i12bp8/TagTinker
2•trueduke•1h ago•0 comments

Why Musicians Are Manufacturing Sold-Out Shows

https://www.bloomberg.com/news/articles/2026-04-17/how-bands-like-cameron-winter-s-geese-are-manu...
2•helsinkiandrew•1h ago•0 comments

A Private Recommendation System I Can Control

https://frankk.site/en/blog/controllable-recommendation-system/
1•langtang1996•1h ago•0 comments

Ask HN: How did you land your first projects as a solo engineer/consultant?

8•modelcroissant•1h ago•2 comments

Waterloo’s live AI-goose tracker. Never get ambushed by a cobra chicken again.

https://www.waddleloo.com/
1•consumer451•1h ago•0 comments

Public grocery stores are having a moment. Can they make food more affordable?

https://www.cbc.ca/radio/thecurrent/public-grocery-stores-9.7168321
3•Teever•1h ago•0 comments

Ask HN: Should I build *another* Markdown task manager?

1•simchri•1h ago•1 comments

Show HN: AI Primer – A Searchable AI Changelog for AI Engineers and Creatives

https://www.ai-primer.com
1•andyasprou•1h ago•0 comments

Deleteduser.com –A $15 PII Magnet

https://mike-sheward.medium.com/deleteduser-com-a-15-pii-magnet-c4396eb21061
3•birdculture•1h ago•0 comments

Shyell – a Rust shell with built-in benchmarking and project-aware prompts

https://github.com/sumant1122/shyell
2•paperplaneflyr•1h ago•0 comments