4 ms·
Speaking of which, what are people using to procedurally convert JSON to XML locally? Let's say for JSON API use by a language that provides an XML library.
by themodelplumber 4y ago
Speaking of which, what are people using to procedurally convert JSON to XML locally? Let's say for JSON API use by a language that provides an XML library.
- moistly 4y agoIf you’re converting to XML, you presumably wish to transform the data, in which case you should be using XPath through XSLT or XQuery; JSON conversion is now a built-in feature.
- themodelplumber 4y agoIt's good to hear JSON conversion is built in. I've got a bit of experience with XPath. Thanks!
- moistly 4y agoYou might be interested in hearing that Saxon is available on four technology platforms: * Java, with language bindings to other JVM-based languages such as Scala * .NET, with language bindings to .NET-based languages such as C# and Visual Basic * Native, with language bindings to C, C++, PHP, and Python * JavaScript, running in all modern browsers and on Node.js XPath is a powerful language in itself; you may not need to use XSLT or XQuery at all.
- themodelplumber 4y agoThat's awesome to see. I've used XPath a little bit with a very powerful plugin for the PHP-based Textpattern CMS: https://forum.textpattern.com/viewtopic.php?id=37932 https://forum.textpattern.com/viewtopic.php?id=37932 Looking forward to exploring more, thanks.
- moistly 4y agohttps://www.w3.org/TR/xpath-31/ https://www.w3.org/TR/xpath-31/ https://www.w3.org/TR/xpath-functions-31/ https://www.w3.org/TR/xpath-functions-31/ A lot has changed. It’s a functional programming language now.
- austinjp 4y agoNot sure I understand your API example, but fwiw in Python I use xmltodict [0] specifically the unparse function to convert a dict to XML. I combine this with ujson for speedy JSON [1] and defusedXML [2] for safety. [0] https://pypi.org/project/xmltodict/ https://pypi.org/project/xmltodict/ [1] https://pypi.org/project/ujson/ https://pypi.org/project/ujson/ [2] https://pypi.org/project/defusedxml/ https://pypi.org/project/defusedxml/