psexton/missing-http

Allow [de]serialisation to MATLAB struct

Opened this issue · 2 comments

The inbuilt library, rather than returning raw JSON strings and leaving the user to parse themselves, returns structs.

With an (optional) dependency on JSONLab or similar, I wonder if this is something you'd be interested in doing? It's a couple of lines change.

Otherwise I'll probably fork and implement it myself...

In my own work I use JSONLab as well, but with several hacks and workarounds for edge & corner cases. (Example: arrays of length one sometimes get collapsed to objects.)

So I've shyed away from bundling it here because I didn't want to "pollute" missing-http with that mess of patches, & didn't want to force usage of JSONLab. I'm not fundamentally opposed to bundling a json (de)seriealizer.

Yep, these are exactly the kinds of issues I'm fixing and patching right now, ha. I doubt that many people use the raw JSON without [de]serializing it, so I doubt you and I are are the only ones facing these issues, and most people's code will probably have a dependency on JSONLab or similar.

It would be great for this to be a replacement for MATLAB's builtin webread() etc functions - which do natively (de)serialise JSON. Even if this means forking JSONLab and putting in the code and patches into missing-http, or rolling your own entirely. (Come to think of it, this means that MATLAB has code to handle JSON, even though they're not publicly exposed...)