Add JSON to XML Translator Interface for Node.js#22
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
Add JSON to XML Translator Interface for Node.js#22devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
- Implement core JSON to XML conversion module with proper XML escaping - Add CLI interface with customizable options (root element, indentation, array item names) - Include comprehensive test suite with 24 tests covering various data types and edge cases - Add detailed documentation with usage examples and API reference - Support for nested objects, arrays, primitives, null values, and special characters - Automatic sanitization of invalid XML element names Co-Authored-By: ronald.kim1@merck.com <ronald.kim1@merck.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a standalone Node.js tool for translating JSON data to XML format. The tool provides both a programmatic API and a command-line interface, making it easy to convert JSON objects to well-formed XML documents.
Link to Devin run: https://app.devin.ai/sessions/9f29ef634e954b0aa566c8d93ee619c7
Requested by: ronald.kim1@merck.com
Changes
index.js): Implements JSON to XML conversion with proper XML character escaping, element name sanitization, and support for nested structures, arrays, and all JSON data typescli.js): Command-line tool with options for customizing root element, indentation, array item names, and output destinationtest.js): 24 tests covering XML escaping, name validation, object/array conversion, edge cases, and custom optionsREADME.md): Detailed usage guide with API reference and examplesexample-input.json): Sample JSON for testing the toolType of Change
Key Features
&,<,>,",')Testing
All 24 tests pass successfully:
Test coverage includes:
Human Review Checklist
Please verify:
tools/json-xml-translator/the appropriate location for this utility?escapeXml()function to ensure all special XML characters are properly handledsanitizeKey()function for edge cases with invalid XML element namesUsage Examples
CLI:
Programmatic API:
Additional Comments
This is a standalone Node.js tool with no dependencies on the existing Python-based teal-agents infrastructure. It requires Node.js >= 18.0.0 to run.