News for hackers. Stuff that matters.
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of... by userbinator on Sunday September 21, 2025 @06:10PM (#45327137)
For something that simple I'd choose a custom binary protocol or something like ASN.1 instead of JSON. It's easier to generate from a HLL and parse in a LLL (I've also been writing Asm for a few decades...)
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of... by leptons on Monday September 22, 2025 @01:06AM (#45329265)
I've done plenty of custom binary protocols before. I can't say they were any better or easier to deal with. I also can't say that the "parser" for a binary format was any easier than a simple, limited JSON parser.

For this specific project I chose JSON and it worked perfectly. Sending JSON from the embedded CPU was also really simple. Yes, there was a little overhead on a slow connection, but I wasn't getting anywhere near saturation. I think it was 9600 bps max on a noisy connection with checksums. If even 10% of the JSON "packets" got through it was still plenty for the system to run.

Re:Sj.h: A tiny little JSON parsing library in ~150 lines of... by johnisgood on Monday September 22, 2025 @04:40AM (#45330643)
I would love to use ASN.1 if other programming languages would match up to Erlang's ASN.1. :(
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of... by Yeask on Monday September 22, 2025 @11:25AM (#45334757)
Even if is not popular here .NET does support ASN.1, not sure if at the same level as Erlang.
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of... by cozzyd on Monday September 22, 2025 @11:54AM (#45335227)
It depends on the use case. JSON has a lot of tooling making it convenient in a lot of cases