Many marketplaces still take product feeds as XML, while many stores keep their catalogue in JSON. When those worlds meet, someone has to translate: hundreds or thousands of product records, each with an identifier, name, price and a handful of details, reshaped without losing or scrambling anything.

The translation itself is mechanical. The JSON to XML Converter on Ovatly applies one deterministic mapping in your browser: keys become elements, @ keys become attributes, arrays repeat as sibling elements. The real work is shaping your product JSON so the mapping produces the structure you want, then proving it on one product before trusting it with the whole catalogue.

Contents

  • Quick answer
  • Shape the JSON first: one root, one array of products
  • Identifiers as attributes, details as elements
  • How to convert product data to XML, step by step
  • Worked example: a small product record
  • Convert one product first, then check against an accepted sample
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

Structure your catalogue as one root key holding an array of product objects. Inside each product, write identifiers such as id and sku as @ keys so they become attributes, and keep names, prices and descriptions as plain keys so they become child elements. Convert one product with the JSON to XML Converter, compare it against a sample feed your marketplace already accepts, adjust the JSON shape until the structures match, then convert the full set and download converted.xml.

Shape the JSON first: one root, one array of products

A feed is a list wrapped in a document, and your JSON should say exactly that. One top-level key names the collection, holding an array with one object per product. You choose the root element name for the document; the array's key becomes the repeated element name, and each object becomes one of those elements.

This shape matters because arrays are how the converter knows what repeats. If products sit as separate numbered keys, or as one large object of objects, the output reproduces that awkward shape as nested elements instead of a clean run of product elements. Time spent arranging the JSON into root, array, records saves far longer untangling the XML afterwards.

Keep every product object consistent, too. The converter maps each record independently, so a field present in one product and absent in another appears in one product element and not the other. A quick pass confirming every record carries the same keys, spelled the same way, makes the feed uniform.

Identifiers as attributes, details as elements

XML elements can carry attributes, short name-and-value pairs inside the opening tag, and product data has a natural split for them. Identifiers are the classic attribute case: an id or sku is short, has no internal structure, and belongs to the product as a whole. Write those keys with an @ prefix, @id and @sku, and they land on the product element as attributes.

Everything else stays a plain key and becomes a child element: name, price, description, and any list such as tags. Lists deserve a thought first: an array becomes repeated elements with the same name, so a product with two tags gets two <tag> elements. If the feed you are matching writes lists some other way, settle that in the JSON shape or a later adjustment.

Prices and stock flags need no special handling, but set your expectations: they become element text. The number 12.5 is written as the characters 12.5, and a true flag as the word true, because XML has no native number or boolean types. The marketplace parses that text back into numbers on its side.

How to convert product data to XML, step by step

  1. Arrange the catalogue JSON: one root key, an array of product objects, identifiers as @ keys, details as plain keys.
  2. Copy one product into a small test document with the same root and array shape.
  3. Open the JSON to XML Converter, paste the test document, and set the root element name.
  4. Compare the output with the accepted sample feed: element names, attribute placement, repeated lists.
  5. Adjust the JSON shape where they differ, reconvert, and repeat until the structures line up.
  6. Paste the full catalogue, convert it the same way, and download converted.xml.

Worked example: a small product record

Here is one product, shaped for a feed on the same pattern the converter uses in its own examples:

{"catalog":{"product":[{"@id":"101","@sku":"MUG-001","name":"Enamel Mug","price":12.5,"tag":["kitchen","gift"]}]}}

Converted with the root element name set to catalog, it becomes:

<catalog>
  <product id="101" sku="MUG-001">
    <name>Enamel Mug</name>
    <price>12.5</price>
    <tag>kitchen</tag>
    <tag>gift</tag>
  </product>
</catalog>

Every mapping rule is visible. The array under the product key produces the <product> element; a second record would produce a second one below it. The @id and @sku keys became attributes. Name and price became child elements, the price as plain text. The tag array repeated as two <tag> elements. Scale this to a full catalogue and the pattern does not change: the array just gets longer.

Convert one product first, then check against an accepted sample

The step most people skip is the comparison. Every marketplace defines its own feed schema: its own element names, attribute choices and required fields. The converter knows none of that, and this guide cannot tell you your marketplace's rules. Hold two documents side by side instead: a sample feed the marketplace already accepts, and your converted test product.

Compare structure, not data. Do the element names match? Do identifiers sit as attributes in both, or does the sample keep them as elements? Do repeated fields repeat the same way? Where they differ, the fix almost always belongs in the JSON shape: rename a key, add or remove an @ prefix, or regroup fields, then convert the test product again. Only when one product lines up should the full catalogue go through: a shape error across five thousand products is a much worse afternoon than the same error on one.

Limitations and honest tradeoffs

The converter emits one consistent dialect of XML, the same mapping applied to every record. That consistency makes a large feed practical, and it is also the limit: the output is not tailored to any marketplace's schema, so a strict marketplace may need the file adjusted before accepting it. Treat the marketplace's documentation and accepted samples as the reference, and the converter as the engine that gets you most of the way there.

Types are the other tradeoff. Prices, counts and flags cross over as text, and null fields become empty elements. A receiving system that needs numbers has to parse them, normal for XML feeds but worth knowing before you promise a typed file. Finally, key names XML would reject are repaired during conversion, with invalid characters replaced by underscores, so check field names in the output if any keys contain spaces or start with digits.

Common mistakes

  • Converting the whole catalogue before testing one product. Shape errors multiply. Prove the mapping on a single record first.
  • Leaving identifiers as plain keys. Without the @ prefix, an id becomes a child element, not an attribute, which may not match the sample.
  • Skipping the sample comparison. The converter guarantees a consistent dialect, not your marketplace's schema. The accepted sample is the only reliable reference.
  • Inconsistent product records. A key present in some products and missing in others produces a ragged feed. Uniform records in, uniform elements out.
  • Expecting typed values in the output. Prices and flags are text in XML; nothing is broken when 12.5 arrives as characters.

FAQs

How should I structure my product JSON before converting? Use one root key holding an array of product objects, one per product. Inside each product, put identifiers like id and sku under @ keys so they become attributes; names, prices and descriptions stay plain keys and become elements.

Will the XML match my marketplace's required format exactly? Not automatically. The converter produces one consistent XML dialect. Each marketplace defines its own schema, so compare the output against an accepted sample feed and adjust your JSON shape until the structures line up.

Why should I convert one product first? One product shows the whole mapping at a glance: which keys became attributes, how arrays repeated, and whether element names match the sample. Fixing the shape on one record is far faster than fixing it across a full catalogue.

What happens to product prices and stock flags? They become element text. A price of 12.5 is written as the text 12.5, and a boolean such as true as the text true, because XML has no native number or boolean types.

Is my product data uploaded anywhere? No. The conversion runs fully in your browser and you download converted.xml, so your catalogue data never leaves your device.

Conclusion

A marketplace feed conversion succeeds or fails on shape, not effort: one root, an array of uniform product records, identifiers as @ attributes, and a one-product test checked against a sample the marketplace accepts. The JSON to XML Converter then does the repetitive part reliably, in your browser, at any catalogue size. For the underlying rules in one place, our explainer on what changes when data moves from JSON to XML covers each one. For more guides in this series, see our Data and JSON Tools guides.

References