Pinned topic XML to JSON conversion in WebSphere Experince factory using builder.
That means any XML given to this builder is converted to String data in JSON.
Is there any way i can specify the data type in json or in IXML api or in builder ?
kevintap 100000QN03111 Posts
Re: XML to JSON conversion in WebSphere Experince factory using builder.2012-10-08T20:19:05ZThis is the accepted answer. This is the accepted answer.Unfortunately, there isn't an easy way to specify how a value like an integer should be converted when converting to JSON. The code that WEF uses will always wrap the values in double quotes as strings.
I have entered an enhancement request for a future product release to help address this and other similar enhancements in the XML to JSON converter.
SystemAdmin 110000D4XK1493 Posts
Re: XML to JSON conversion in WebSphere Experince factory using builder.2012-10-17T11:43:26ZThis is the accepted answer. This is the accepted answer.
- kevintap 100000QN03
Thanks for replying and taking the issue to the further enahancment.But the issue is ::
We want to achieve numerical sorting in Filtering select . Since filtering select always reads json data ,it applies the alphanumeric sorting or numerical sorting on the basis of data type of JSON data.
Having said that Filtering select always sort the data as string ( alphanumeric ).
I have achieved numerical sorting in filtering select by creating our own DOJO data Store and then change the JSON data from String to Int. Please find the attachment .
BUT this approach is not align with our conventions of project and it is breaking the re-usability too, We are using the concept of shared library(RDD) and DFS(Data Field setting) builder .
Is there any way we can incorporate this three builders in a XML (RDD) file 1.XML to JSON convertor 2. DOJO data store 3. DOJO filtering select . Or in other words can we make a data definition in a xml which uses these three builders .Later that Xml file will be read by DFS,So that other developers just need to select a field type and lookup (xml-data) in DFS.
Feel free to ask more question if you need more clarifications.
mones 060000WA2T1 Post
Re: XML to JSON conversion in WebSphere Experince factory using builder.2013-04-18T12:46:46ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
You can use a custom class to traverse your IXml and generate the JSON you like with the help of the google-gson library.
We've solved a similar issue (not datatype but structure related) with this approach and it's relatively easy to do. The resulting class is fully reusable (unless you want a different format, of course :-)