PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → JSON to Variant stripping spaces from string values
JSON to Variant stripping spaces from string values
Iniciado por guest, 10,abr. 2018 21:29 - 2 respuestas
Publicado el 10,abril 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
Publicado el 11,abril 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
Publicado el 11,abril 2018 - 06:15
Thanks King. it was user error on my part