User Rating 0.0
Total Usage 0 times
RESX Input
JSON Output
Is this tool helpful?

Your feedback helps us improve.

About

RESX files are XML-based resource containers used across .NET ecosystems to store localized strings, metadata, and binary references. Each data node carries a name attribute (the resource key) and a nested value element (the resource content). Manually extracting these pairs into JSON for front-end consumption or API integration is tedious and error-prone. A missed closing tag or mismatched encoding silently corrupts your localization pipeline. This tool parses the raw XML DOM, extracts every data node, and serializes the result as a flat JSON object. It handles xml:space preservation, CDATA content, and empty values without data loss.

Optional regex filtering lets you isolate subsets of keys (e.g., only keys matching PageTitle_.*) before export. This replicates the matchPattern option found in build tools like grunt-resxtojson but requires zero CLI setup. Note: this tool processes the XML structure only. It does not resolve assembly references, embedded binary resources (type System.Byte[]), or .resx designer metadata nodes. Those nodes are skipped by default. Pro tip: if your RESX contains keys with dots (e.g., Form1.Label1.Text), consider post-processing the flat JSON into a nested structure in your build pipeline.

resx json converter xml resource files localization i18n dotnet

Formulas

The conversion follows a deterministic extraction pipeline from XML DOM to JSON object:

parse(resx) xmlDoc querySelectorAll("data") filter(matchPattern) reduce(pairs) JSON.stringify(obj, null, indent)

Each data element is filtered through two exclusion rules before key extraction:

include = ¬hasAttribute("type") ¬hasAttribute("mimetype")

When a matchPattern regex is provided, an additional filter is applied:

include = include matchPattern.test(name)

Where name is the data element's name attribute. The final JSON object is a flat dictionary: { key1: value1, key2: value2, … }. Duplicate keys follow last-write-wins semantics, consistent with .NET's ResourceManager behavior at runtime.

Reference Data

RESX ElementXML PathJSON OutputNotes
data (string)<data name="key"><value>text</value></data>{"key": "text"}Standard string resource
data with xml:space<data name="k" xml:space="preserve">{"k": " padded "}Whitespace preserved exactly
data with comment<data><value>v</value><comment>c</comment></data>{"key": "v"}Comments are discarded
Empty value<data name="k"><value/></data>{"k": ""}Empty string preserved
CDATA value<value><![CDATA[html]]></value>{"k": "html"}CDATA unwrapped to text
Multiline value<value>line1\nline2</value>{"k": "line1\nline2"}Newlines in JSON string
resheader<resheader name="resmimetype">SkippedMetadata, not a resource
assembly<assembly alias="...">SkippedAssembly reference only
data with type<data name="k" type="System.Byte[]">SkippedBinary resource, not text
data with mimetype<data name="k" mimetype="...">SkippedEmbedded object reference
Duplicate keysTwo <data name="k">Last value winsMatches .NET runtime behavior
Special characters& < >{"k": "& < >"}XML entities decoded
Unicode content<value>日本語</value>{"k": "日本語"}UTF-8 preserved
Namespaced root<root xmlns="...">Parsed normallyNamespace ignored for traversal
Schema declarations<xsd:schema>SkippedXSD definitions ignored

Frequently Asked Questions

Any element that carries a type attribute (e.g., System.Drawing.Bitmap, System.Byte[]) or a mimetype attribute is automatically excluded from the JSON output. These nodes contain base64-encoded binary payloads or serialized .NET objects that have no meaningful string representation. Only pure text resources (those with just a name and value) are extracted.
The converter uses last-write-wins semantics. If two data nodes share the key "Submit", the value from the node appearing later in the XML document overwrites the earlier one. This mirrors the behavior of .NET's ResourceManager at runtime. A warning toast is displayed listing any duplicate keys detected so you can audit your source RESX file.
Yes. Enter the pattern in standard JavaScript regex literal format. The tool parses patterns like /PageTitle_.*/i - the trailing i flag enables case-insensitive matching. Supported flags are i (case-insensitive), g (global, though irrelevant here since each key is tested once), and m (multiline). If no slashes are provided, the input is treated as a plain pattern string with no flags.
No. The converter targets only <data> elements. RESX files typically contain <resheader> nodes (specifying MIME type, reader/writer class info), <xsd:schema> blocks (XML Schema definitions), and <assembly> references. All of these are structural metadata and are silently skipped. Only <data> nodes that pass the type/mimetype exclusion filter appear in the JSON.
The browser's native DOMParser automatically decodes XML entities: & becomes &, < becomes <, > becomes >, and so on. CDATA sections are unwrapped to their raw text content. The resulting plain text is then safely serialized via JSON.stringify, which handles JSON-escaping of quotes, backslashes, and control characters.
The RESX XML schema has remained stable across .NET Framework 1.1 through .NET 8. The root element is always <root>, and string resources always use <data name><value> structure regardless of framework version. The tool ignores version-specific attributes like System.Resources.ResXResourceReader assembly qualifications. Files generated by Visual Studio 2005 through 2022, Rider, or manual editing are all compatible.