Groovy XML & JSON

Parsing and generating XML and JSON in Groovy. Tutorials on XmlSlurper, XmlParser, MarkupBuilder, JsonSlurper, JsonBuilder, and REST APIs.

Groovy JSON Output with JsonOutput and JsonBuilder – 10+ Tested Examples

Groovy JSON output with JsonOutput, JsonBuilder, and StreamingJsonBuilder. 10+ examples for generating JSON from maps, objects, and lists on Groovy 5.x. “Parsing JSON is half the battle. The other half is generating it cleanly – and Groovy gives you three different tools to do just that.” Douglas Crockford, JSON Specification Author Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: Beginner to Intermediate | Reading Time: 22 minutes You’ve parsed JSON with JsonSlurper. Now you need ... Read More

Groovy Create and Modify XML – MarkupBuilder, StreamingMarkupBuilder with 12 Examples

Learn to Groovy create XML and modify with 12 examples using MarkupBuilder, StreamingMarkupBuilder, XmlParser, and XmlUtil. Tested on Groovy 5.x. “Writing XML by hand is like writing assembly – you can do it, but there are better tools for the job.” Tim Bray, XML Specification Co-author Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: Intermediate | Reading Time: 22 minutes Reading XML is only half the story – in real projects, you also need to ... Read More

12 Groovy XmlSlurper Examples – Parse XML the Easy Way

Groovy XmlSlurper is explored here with 12 practical examples covering XML parsing, namespaces, attributes, GPath queries, and real-world patterns. Tested on Groovy 5.x. “XML is like violence – if it doesn’t solve your problems, you’re not using enough of it.” Tim Berners-Lee, Web Standards Pioneer Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: Intermediate | Reading Time: 20 minutes If you’ve wrestled with DOM parsers, SAX handlers, or JAXB annotations just to pull a few ... Read More