Web Connection
Problem using REST
Gravatar is a globally recognized avatar based on your email address. Problem using REST
  Michele
  All
  Jul 7, 2021 @ 02:40am

I have this problem when receiving a REST request... I receive one parameter and when i read it it is changed... In my first rows of my rest app i have goWCServer.oRequest.cFormVars that contains this value

&{"id": 0,"value":null,"report":null,"cabi":01111,"desb":"AA",
      "session":"_63B0O8K0F","table": "tabi"
    }

in loParams, that is the object that i receive in my app, generated by Web Connection, i have

where the property "cabi" has an incorrect value different from what i send.... The particular thing is that i pass a numeric value beginning with 0.... Not normal, but i expect that this value was managed as a number without condidering the initial 0. If i pass "cabi":1111 no problems..

Thanks

Gravatar is a globally recognized avatar based on your email address. re: Problem using REST
  Rick Strahl
  Michele
  Jul 7, 2021 @ 09:45am

Well, 0111 is an invalid value for a number so that would account for it. I think it's being interpreted as something other than decimal.

You can try this out like this:

DO wwJsonSerializer

TEXT TO lcJson NOSHOW
{"id": 0,"value":null,"report":null,"cabi": 01111,"desb":"AA",
      "session":"_63B0O8K0F","table": "tabi"
    }
ENDTEXT    

loSer = CREATEOBJECT("wwJsonSerializer")
loData = loSer.Deserialize(lcJson)
? loData.cabi   && 585.00
? loData.session

Now change the number to a proper 1111 and it returns the appropriate result or make the value into a string "01111".

+++ Rick ---

© 1996-2021