---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/artifacts/xml/variables/jsonToXmlTool.md
description: A tool that converts JSON (inline or from an artifact) to XML.
---

# Variable: jsonToXmlTool

```ts
const jsonToXmlTool: Tool<SpooledXmlArtifact>;
```

Defined in: [src/batteries/artifacts/xml/index.ts:651](https://github.com/NHTIO/ADK/blob/v1.20260907.0/src/src/batteries/artifacts/xml/index.ts#L651)

A tool that converts JSON (inline or from an artifact) to XML.

## Remarks

Input is either `text` (inline JSON) or `call_id` (a JSON artifact from earlier in this turn).
Provide exactly one. Returns a new [SpooledXmlArtifact](../classes/SpooledXmlArtifact.md).

Note: XML has no faithful JSON inverse. A JSON document that never came from XML may not
rebuild into sensible markup. This tool converts on a best-effort basis; the result may not
round-trip perfectly back to the original JSON.
