Description


JSON is case sensitive - and as it stands, there\'s no automatic way in Uniface (via standard proc commands - up to and including 9.7.01) to define a mapping to/from JSON. For example, receiving a JSON string where \"CustomerId\" contains the customer number, there\'s no easy and straight forward was to transform to \"CUSTOMER_NUMBER.CUSTOMER\". Going the other way, there is no easy and straight forward way to transform \"CUSTOMER_NUMBER.CUSTOMER\" to \"CustomerId\".

Use Case


With XML, Uniface provides a way to create either a map or use XSLT to transform between a Uniface component and the external document. With an open standard such as JSON, and the importance of EAI / SOA - it would be awesome to have an automated way of converting to/from JSON within Uniface. Of course, this would benefit Web Services, Mobile development and Integration - to mention but a few.

Importance


High

Type


Proc Code

Operating System


Not Applicable

Status


Open

One thought on “JSON Case Sensitive”

  1. Using jsonToStruct() you can put your json in a struct and then use the struct functionality to transform the names in the way you want using a recursive entry such as the following:

    entry transform
    params
    struct strct : inout
    endparms

    $1 = strct->$memberCount
    if (strct->$name == “CustomerId”) ; you can also do a case-insensitive match
    strct->$name = “CUSTOMER_NUMBER.CUSTOMER”
    endif
    for $2 = 1 to $1
    call transform(strct->*{$2}) ; recursive call
    endfor
    end ;

    After that you can make a new json text with structTojson() with the new names, or you can use structToComponent() to load this struct into the entities painted on your form; although probably some more transformations will be required.

Leave a Reply