Beware XML-to-JSON Information Loss (Junos with Ansible)
When you want to transport a complex data structure between components of a distributed system you’re usually using a platform-independent data encoding format like XML, YAML, or JSON.
XML was the hip encoding format in days when Junos and Cisco Nexus OS was designed and lost most of its popularity in the meantime due to its complexity (attributes, namespaces…) that makes it hard to deal with XML documents in most programming languages.
JSON is the new cool kid on the block. It’s less complex than XML, maps better into data structures supported by modern programming languages, and has decently fast parser implementations.
… updated on Wednesday, March 17, 2021 06:35 UTC
XML-to-JSON Information Loss, Cisco Nexus OS Edition
Last week I wrote about the interesting challenges you might encounter when using data generated by a Junos device in an Ansible playbook. Unfortunately it’s not just Junos – every system built around XML-based data structures might experience the same issues, including Cisco Nexus OS.
… updated on Wednesday, March 17, 2021 06:40 UTC
Fixing XML-to-JSON Conversion Challenges
In the last weeks I described the challenges you might face when converting XML documents that contain lists with a single element into JSON, be it on device (Nexus OS) or in an Ansible module. Now let’s see how we can fix that.
Blog posts in this series
- Beware XML-to-JSON Information Loss (Junos with Ansible)
- XML-to-JSON Information Loss, Cisco Nexus OS Edition
- Fixing XML-to-JSON Conversion Challenges (this post)