Thanks Brian,

Using many sites that provide online conversion between the two format such as 
this:

http://www.utilities-online.info/xmltojson/#.V03_F2grIuU

yield the correct result.


{
  "record": {
    "property1": {
      "#text": [
        "Lake",
        "River",
        "National_State Park"
      ]
    },
    "property2": {
      "#text": [
        "A:Value1",
        "B:Value2",
        "C:Value3",
        "D:Value4",
        "E:Value5"
      ]
    }
  }
}


I am wondering how much more is missing from the stylesheet to enable that, I 
guess I have to do some reading now to familiarize myself with that.


Thanks,
Keith

________________________________
From: Keith Lim <[email protected]>
Sent: Tuesday, May 31, 2016 4:07 PM
To: [email protected]
Subject: Which processor to use to cleanly convert xml to json?


Which processor should I use to cleanly convert from xml to json?

This article illustrates using TransformXML with a stylesheet to convert xml to 
json.

https://community.hortonworks.com/articles/29474/nifi-converting-xml-to-json.html

However, I am seeing that it does not convert values with special tag such the 
embedded <br> tag as below:


XML fragment:

<record>

    <property1>Lake<BR/>River<BR/>National_State Park</property1>
    
<property2>A:Value1<BR/>B:Value2<BR/>C:Value3<BR/>D:Value4<BR/>E:Value5</property2>

</record>


Converted Json:


{ "record" : {

        "property1" : { "BR" :["",""] },
        "property2" : { "BR" :["","","",""] }

}}

I may need to readup on stylesheet however, this is just the problem I am 
seeing, and don't know what other issue may crop up using this script.

Thanks,
Keith

Reply via email to