AI Tools for XML and JSON Development
The explosion of AI tools has made a significant impact on the field of software development – not by replacing software engineers as some have predicted – but by actually increasing their value by freeing them to focus on higher-level tasks. By automating low-level code generation, for instance, AI increases development speed and opens the doors to deeper innovation.
To give developers the AI tools they need to realize these productivity and creativity gains, Altova has integrated AI functionality in XMLSpy for XML and JSON editing tasks.
Here’s how the XMLSpy AI Assistant works.
AI for XML Editing
Accessing the AI Assistant in XMLSpy is as easy entering your current Open AI key using the Options dialog. This enables ChatGPT functionality directly in XMLSpy.
Since the API is accessed directly by the editor, you’ll immediately have access to the latest available model (as well as previous models). Today that includes the new GPT-4 Turbo preview announced at Open AI Dev Day on November 6, 2023. GPT-4 Turbo offers several advantages, including a 128K context window, knowledge data up to April 2023, and optimized performance that allows a lower price tag compared to GPT 4. The current GPT-4 Turbo preview is accessed by passing gpt-4-1106-preview
in the API. In XMLSpy, simply select it from the Default Model drop-down. When the production version is released in the coming weeks, it will be immediately available in the XMLSpy AI Assistant.
With a default model selected, now you’re ready to select AI Assistant from the Windows menu and start composing a prompt.
The possibilities are endless, but some example ways to use the AI Assistant include:
- Create an XSD for storing human resources data
- Create an instance with example financial transactions
- Create a sample instance for the active XML Schema document
- Create an XSL transformation that lists all root elements from the active file
Here we’ve asked the XML AI Assistant to generate an XSD for an expense report.
Once the response is returned, we can copy it to the clipboard or create a new document with the generated code.
Below is the AI-generated XSD opened in the graphical XML Schema editor, where we can review and edit it as necessary.
The AI Assistant can also generate a sample instance for the XSD filled with real-world data and any other documents to get a jump start on coding.
We can also ask the AI Assistant to generate XSL, XPath, and XQuery. XPath or XQuery statements can be opened directly in the XPath/XQuery window for testing and further refinement. The AI returns the expression corresponding to the prompt as well as an explanation of what the code is doing and what results are expected.
Generate JSON with AI
The same AI tools for XML work with JSON. You can use natural language prompts to, for example:
- Generate a JSON Schema for a project management app
- Generate a JSON instance for a given schema
- Generate sample JSON data for medical records
- And so on
Let’s prompt the AI Assistant to generate sample JSON data for medical records.
The JSON data generated above can be opened, explored, and refined in the XMLSpy JSON Grid View.
Using AI to generate JSON and XML code is a huge productivity enhancer that allows developers to get things done faster. It frees them to focus on higher-level tasks, creativity, and problem-solving, while AI handles routine and repetitive tasks.
The AI Assistant is available starting with XMLSpy 2024. Download a free, 30-day trial to get started with AI for XML and JSON today.