Hi All,

                We are trying to convert json to xml. But some of our json key 
contains "/" character in it.
Due to which the transformation (json:transform-from-json()) is failing with 
invalid lexical.

Is there any other option to transform such json.

Is there any other method / custom code to do the transformation to resolve 
this issue.

Error:

XDMP-QNAMELEXFORM: fn:QName("", "entities/0C4kKs7/attributes/CountryOfOrigin") 
-- Invalid lexical form for Qname

Xquery:

import module namespace json="http://marklogic.com/xdmp/json"; at 
"/MarkLogic/json/json.xqy";


let $custom := json:config("custom")

let $transform :=

json:transform-from-json('
{
"crosswalks": [
      {
        "uri": "entities/0C4kKs7/crosswalks/1T5YWYSh",
        "type": "configuration/sources/Reltio",
        "value": "0C4kKs7",
        "reltioLoadDate": "2016-02-19T01:01:42.324Z",
        "createDate": "2016-02-02T12:48:43.627Z",
        "updateDate": "2016-02-02T12:48:43.627Z",
        "attributes": [

          "entities/0C4kKs7/attributes/CountryOfOrigin",
          "entities/0C4kKs7/attributes/IsVoid/BaNdOmc",
          "entities/0C4kKs7/attributes/CountryOfOrigin/OaZKd0G",
          "entities/0C4kKs7/attributes/OriginalReleaseYear/1T5YWLfv",
          "entities/0C4kKs7/attributes/MPMNumber/1T5YW0Md",
          "entities/0C4kKs7/attributes/Identifiers/1T5YW8t9/ID/1T5YWHPf",
          
"entities/0C4kKs7/attributes/BoxOffice/1T5YWPwB/DomesticBoxOffice/1T5YWUCR",
          "entities/0C4kKs7/attributes/OriginalMadeFor/1QDXr7WM",
          "entities/0C4kKs7/attributes/BoxOffice/1T5YWPwB",
          "entities/0C4kKs7/attributes/Type/1QDXqqTK",
          "entities/0C4kKs7/attributes/LibraryTitle/1T5YW4ct",
          "entities/0C4kKs7/attributes/CountryOfOrigin/OaZI9Yy",
          "entities/0C4kKs7/attributes/Identifiers/1T5YW8t9/Type/1T5YWD9P",
          "entities/0C4kKs7/attributes/Identifiers/1T5YW8t9"
        ],
        "singleAttributeUpdateDates": {

          "entities/0C4kKs7/attributes/CountryOfOrigin": 
"2016-02-02T12:49:49.539Z",
          "entities/0C4kKs7/attributes/IsVoid/BaNdOmc": 
"2016-02-19T01:01:42.324Z",
          "entities/0C4kKs7/attributes/CountryOfOrigin/OaZKd0G": 
"2016-02-02T13:01:51.933Z",
          "entities/0C4kKs7/attributes/OriginalMadeFor/1QDXr7WM": 
"2016-02-02T12:50:57.215Z",
          "entities/0C4kKs7/attributes/Type/1QDXqqTK": 
"2016-02-02T12:49:09.023Z",
          "entities/0C4kKs7/attributes/CountryOfOrigin/OaZI9Yy": 
"2016-02-02T12:49:34.433Z"
        }
      }
    ]
}
', $custom)

return
$transform



Thanks & Regards,
Santhosh
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to