JADE Environment Development Ideas

Rest API / JSON parser - transform initial uppercase character to lower case

Our client is sending a json payload to our Rest API with elements that start with uppercase characters. But this causes an exception because our proxy request classes properties defined in Jade can only ever start with a lowercase character. We have had to transform the json message in an Azure middleware layer to work around. Could the JSON parser be modified to automatically convert a starting uppercase character to lower case before validating the element against our request properties.

Here is a sample of a payload they send, I have processed this thru a JSON formatter and validator and it says it is valid json.

{

"Stepid": "BasicItem-387882",

"Links": {

"Product_To_BrandHierarchy": "GLITTER G"

},

"Values": {

"AT_ProductKey": "2559293",

"AT_ProductShortName": "B/G SS SOLID 8MM 68MM",

"AT_InStoreStartDate": "19-Feb-2019",

"AT_HighRiskIndicator": "N",

"AT_Character": "BUNNY;CAR;CAT",

"AT_ShippingProductWeight": "0.10 kg"

}

}

  • Julie Harliwich
  • Jan 5 2021
  • Future consideration (Long term)
  • Attach files
  • Julie Harliwich commented
    30 Apr 02:16am

    Tim, I like your first idea "Provide the ability to have "Web names" on our JADE properties, e.g. by annotations which will allow for mapping of these json properties to our JADE properties"

  • Julie Harliwich commented
    30 Apr 02:14am

    BeeJay, when we told the client that we needed lowercase, the response was that Jade should be able to handle uppercase because valid json syntax. When it is a clients bespoke Jade system talking to another of their systems, it becomes our problem. So we currently intercepting raw json in processRequest and modifying it before it gets to parser.

  • BeeJay commented
    30 Apr 02:07am

    I may be missing something, but as the Rest service provider aren't you the one who documents the APIs for your Rest service? As such, the document for the Rest APIs could specify that the property names all need to start with a lower case character, and then it's up to the consumer(s) of your Rest service API to follow the documented requirements?

    Otherwise, isn't this somewhat of a case of the tail wagging the dog having a consumer of your Rest service API dictating what they're going to send through to your Rest service provider and expecting you to adjust your Rest service API to suit them?

  • Tim Aitchison commented
    30 Apr 01:16am

    Edit to the above: by "uppercase the first letters" I meant "lowercase the first letters" :)
    Or more generally, "make identifiers in the json string which are not valid JADE names into valid JADE names."

  • Tim Aitchison commented
    29 Apr 11:56pm

    I don't think it's viable to simply uppercase the first letters as a general rule, but there's two main ways we could make life easier:

    1. Provide the ability to have "Web names" on our JADE properties, e.g. by annotations which will allow for mapping of these json properties to our JADE properties.

    2. Provide the ability to deserialize json strings to jdos (which helps some other things also)