JSON support

Author: alejandron@afsi.com (danieto)

Does Uniface 9.4 Supports JSON?

For example, creating a Uniface Web Service that will receive data in a JSON format instead of XML.

Regards,
Alejandro

6 Comments

  1. Hi Alejandro,

    what exactly do you need? I got a tiny code that turns a Uniface List into JSON! This will be part of my next "Uniface Frontend Templating" series (Part 4).

    In case of beeing impatient, the code is not that sophisticated. JSON is a pretty clean form for structured data.

    "Uniface uses the JSON format for updating dynamic server pages using websave and webload"

    I would assume U9.4 NOT to deliver JSON directy for other purposes than websave and webload! If you want to digg deeper into this, then let me know :)

     

    Saludos,

    -GHAN-


    Author: -GHAN- (hansen@ahp-gmbh.de)
  2. Hi,

    I've got some very hacky and quite complex code for turning lists into JSON and vis versa - I had to remove UTF8 at the same time.

    I'd be too embarrased to share it though.

    I'd like to see more direct support and a more elegant solution


    Author: AyeJayUU (awilkins1@btinternet.com)
  3. Just because I'm that curios ... @ AyeJay

    Why do you want to return JSON into Uniface? ... I return those data as params which are accessible via $webinfo("input") ... or build Strings, that are Uniface-Like (eg. csv FIELD=VAL|FIELD2=VAL|) and replace "|" by gold internally (allthough we could also do that in JavaScript before sending the data back in).

    Doing so makes it easier to handle it :)

    My code looks like : http://www.udev.info/uniface/uniface-web-tools-ulist2json/

     

    kind regards,

    -GHAN-

     

    /EDIT: getting old, I guess. I already did that contribution with complete examples on 2010-07-23! ... *doh*


    Author: -GHAN- (hansen@ahp-gmbh.de)
  4. Interesting question - one I never really asked myself.

    Because I was accessing someone else's web service and I was told I was going to get JSON as a response  and picking the data out of JSON in a sort of ad-hoc way is the idiom in the application in question.

    I was doing this in the context of a uniface service rather than web page.

    I'd like to find a better way - Always willing to share my mistakes (within the bounds of commercial confidentiallity) and hopefully learn from them

    Thanks for the lists 2 JSON code


    Author: AyeJayUU (awilkins1@btinternet.com)
  5. ... you're welcome :)


    Author: -GHAN- (hansen@ahp-gmbh.de)
  6. Unfortunately the webload/websave commands do not have the same level of component structure mapping support that are available for xmlload/xmlsave. They just dump out the entire structure and currently only seem meant to support Dynamic Server Pages. We use an XSLT transformation to generate JSON from an XML document.


    Author: heydona (andyh@collegenet.com)