Page 1 of 1
Using Universal Display File to read/write JSON
Posted: Fri Feb 06, 2015 9:31 am
by dieter
Hello,
we wish to implement webservices on our iSeries. The data format shall be JSON. I think Universal Display files can be a way to send data from the iSeries to the pc users. (I didn't try it). But is an Universal Display file also a solution to read JSON data into the iSeries? Do you have an example how this could be implemented?
Dieter
Re: Using Universal Display File to read/write JSON
Posted: Fri Feb 06, 2015 11:03 am
by Scott Klement
The Univrersal Display File is a general-purpose templating/formatting tool. It can be used to format output in any format... JSON, XML, CSV, HTML, etc.. just about any text output you wish can be generated with it. But, you need to code the text and tell it where to insert variable data. It's basically an open access version of CGIDEV2. So you can generate JSON with it if you like, but the tool doesn't exactly understand JSON itself... it's you who codes that part, it won't generate it for you.
For input data, the UDF has a built-in ability to receive in the format that HTML uses to send forms. (i.e. URL-encoded name/value pairs.) It does not understand JSON.
I do have an open source tool that can be used to read/generate JSON, it's called YAJL. I have a presentation that I give on the topic at conferences & user groups, and you can download the handout for that presentation here:
http://www.scottklement.com/presentations/#YAJL
You can find the YAJL program itself here:
http://www.scottklement.com/yajl/
Re: Using Universal Display File to read/write JSON
Posted: Fri Feb 06, 2015 12:27 pm
by dieter
Thank you Scott. I will have a look to your YAJL project.