This Insomnia plugin generates extremely simple, dummy and valid pseudo-random XML samples that are ready to be used inside JSON properties. The generated XML is compact and properly escaped to ensure compatibility with JSON parsers.
- Generate pseudo-random XML with customizable root element and child elements.
- Ensures all double quotes are escaped for JSON compatibility.
- Compact XML format without unnecessary newlines.
- Real-world-like XML element names for better usability.
- Download or clone this repository.
- Place the folder in your Insomnia plugins directory.
- Restart Insomnia to load the plugin.
- Open Insomnia and create or edit a request.
- Use the
Random XML for JSON
template tag. - Configure the root element name and the number of child elements.
- The plugin will generate a random XML string, escaped and ready to be used in JSON properties.
Input:
{
"Date": "{% faker 'randomDatePast' %}",
"MessageType": "{% faker 'randomTransactionType' %}",
"XmlContent": "{% randomXmlForJson 'root', 3 %}"
}
Output:
{
"date": "2024-09-03T23:36:11.868Z",
"messageType": "withdrawal",
"xmlContent": "<root><address>SampleValue1</address><date>SampleValue2</date><status>SampleValue3</status></root>"
}
To modify or enhance the plugin:
- Edit the
main.js
file. - Test your changes by restarting Insomnia.
This plugin is open-source and available under the MIT License.