# Handling special characters in JSON keys during transformation

**URL:** <https://community.cdata.com/t/handling-special-characters-in-json-keys-during-transformation/829>\
**Category:** CData Virtuality \[Archived\]\
**Tags:** article, cdata-virtuality\
**Created:** [July 12, 2024, 4:22pm UTC](https://community.cdata.com/t/handling-special-characters-in-json-keys-during-transformation/829 "2024-07-12T16:22:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@anonymous](https://community.cdata.com/u/anonymous)\
**Post date:** [July 12, 2024, 4:22pm UTC](https://community.cdata.com/t/handling-special-characters-in-json-keys-during-transformation/829/1 "2024-07-12T16:22:39Z")

</div>

When transforming JSON documents into a tabular format, you might stumble upon certain keys that produce an error message.

This document is valid JSON, but generates an error, such as “XPath syntax error at char 0 in {80x}:  
Separator needed after numeric literal” when parsing it in Data Virtuality.

| `{``  ``"80x60": "https://datavirtuality.com/wp-content/uploads/sites/2/2016/09/solutions@3x.png",``}` |

| `SELECT`&nbsp;`xmlTable.*``FROM`&nbsp;`(call ``"file"``.getFiles(``'key_example.json'``)) f,``XMLTABLE(XMLNAMESPACES( ``'http://www.w3.org/2001/XMLSchema-instance'`&nbsp;`as`&nbsp;`"xsi"`&nbsp;`),``'/root'`&nbsp;`PASSING JSONTOXML(``'root'``,to_chars(f.file,``'UTF-8'``))`` ``COLUMNS ``"80x60"`&nbsp;`STRING PATH ``'80x60'``) ``"xmlTable"` |

This is due to the fact that Data Virtuality internally transforms the JSON document into an XML document for easier parsing. Since an identifier in XML may not start with a number, it gets escaped and rewritten to&nbsp;_\_u0038\_0x60_. Hence, you will need to pass this value as an XPath expression for referring to your JSON key.

| `SELECT`&nbsp;`xmlTable.*``FROM`&nbsp;`(call ``"file"``.getFiles(``'key_example.json'``)) f,``XMLTABLE(XMLNAMESPACES( ``'http://www.w3.org/2001/XMLSchema-instance'`&nbsp;`as`&nbsp;`"xsi"`&nbsp;`),``'/root'`&nbsp;`PASSING JSONTOXML(``'root'``,to_chars(f.file,``'UTF-8'``))`` ``COLUMNS ``"80x60"`&nbsp;`STRING PATH ``'_u0038_0x60'``) ``"xmlTable"` |

In order to look up this transformed key name, you can run the&nbsp;_XMLESCAPENAME_&nbsp;function (_SELECT XMLESCAPENAME(‘80x60’, true)_) which will return the correct name of the node in the XML document.
