PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → JSON to Variant stripping spaces from string values
JSON to Variant stripping spaces from string values
Débuté par steve erts, 10 avr. 2018 21:29 - 2 réponses
Posté le 10 avril 2018 - 21:29
Hi,

I'm using JSONToVariant to take a JSON payload and convert into an object and write the elements out to our database. Everything is working fine EXCEPT that and string variable that contains spaces the spaces are removed.

sPayload = (the json file being inspected)

vPayload is Variant=JSONToVariant(sPayload)

IF vPayload.Client.Country<>"" THEN

Client.Country=vPayload.Client.Country

END

In the above example if the original value for "County" in the JSON file is "United States" when it is written to the database the space is stripped out and the value saved is "UnitedStates"

What am I doing wrong?

Thanks!

Steve
Posté le 11 avril 2018 - 02:43
Hi

Hard to say as 'dun know the content of json

sPayload = (the json file being inspected), ???

and you may chop part of yr JSON and show us if it's too lengthy.

Cheers

King
Posté le 11 avril 2018 - 06:15
Thanks King. it was user error on my part