Forum Discussion

manchis's avatar
manchis
New Contributor
5 years ago

How to convert JSON to XML with multiple XSD Validations applied

We have a requirement to convert JSON to XML and while converting need to validate with multiple XSD’s (presently I have 2 xsds) and generate XML. Please let me know the possible approaches If possible with an example.

1 Reply

  • alchemiz's avatar
    alchemiz
    Contributor III

    On top of my head you can replaceAll the ‘\r\n’ with a keyword e.g. ‘[CRLF]’ this will be a place holder for you to revert it back when doing the toObject e.g.

    $variables.replaceAll(‘\r\n’,‘[CRLF]’).split(‘\n’)…toObject((x,y)=>…], (x,y)=>x.split(‘=’)[1].replaceAll(‘[CRLF]’,‘\r\n’)) 😄