NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Thys on May 04, 2017, 03:36:06 AM

Title: JSON to XML and vice versa
Post by: Thys on May 04, 2017, 03:36:06 AM
Hi,

Just wondering if there is an easy way to convert from JSON to XML and vice versa? Should probably be methods within jfiles and xfiles.

Thys
Title: Re: JSON to XML and vice versa
Post by: Bruce on May 05, 2017, 01:08:52 AM
it's an intriguing idea,
are you thinking of a "known" structure, or "any" structure?

cheers
Bruce
Title: Re: JSON to XML and vice versa
Post by: osquiabro on May 05, 2017, 04:41:58 AM
try with demo of easyxml http://www.ingasoftplus.com/Downloads.php?ProductID=293
Title: Re: JSON to XML and vice versa
Post by: Thys on May 08, 2017, 12:24:38 AM
Hi Bruce.

Both jFiles and xFiles work from the premise on the one side to have a fixed Clarion data structure, and on the other side the formatted text structure - and the class methods assist to convert from the one structure to the other. But with this I think it would be (for example) an XML object being created from a JSON object's method - and vice versa, so there should be no need for a Clarion structure to do the conversion.

Thys
Title: Re: JSON to XML and vice versa
Post by: Thys on May 08, 2017, 12:25:46 AM
try with demo of easyxml http://www.ingasoftplus.com/Downloads.php?ProductID=293

Thanks, I'll have a look at it.
Title: Re: JSON to XML and vice versa
Post by: Bruce on May 08, 2017, 07:03:54 AM
If both had an interim "format free" state then yes, you are right, it should be possible.
jFiles does have such a state, but alas xFiles does not.

So it would be relatively easy to create xml from Json - simply by adding an output method to jFiles so save the interim state to xml instead of json.

In practice everyone would want waaay too much control over the xml - this should be an attribute, that should be a field, and so on.

I'm sure there are tools to do this, but it's not a road I have a need to go down <g>.

cheers
Bruce