Json is a common data format, but in NAV it’s support isn’t huge. Especially when it comes to parsing Json. Of course one can use Newtonsoft dll, wrap it in c/side code and parse the contents. Still a bit too complex and not very straightforward.
But what if we just deserialize or serialize Json to XML and XML to Json? XML support in NAV is good, and anyone know how to handle it using xmlports or .Net XmlDomDocument. Second is preferable as xpath is way more flexible than xmlports.
Honestly, the code below isn’t mine, I’ve googled it an all credits goes to Ponç J. Llaneras .
This is very useful bit of code indeed.
The only issue I have with this – is the fact that this one will not work in extensions until MS add .Net support to extensions if this will ever happens. We still need an external dll too.
Just wondering if anyone built a json parser in pure C/AL? Or maybe MS will just include it into future NAV?
In answer to your final point – if you’re building extensions then you’re working in AL in VS Code. In which case you can use the native Json types in the AL language.
That’s makes a lot of sense, James. I should improve my AL knowlege