Hi,
I guess this will be a stupid question and an easy solution is available ....
I have a memprt with a json-string that I got back from a service.
In that json-string we have data where escape-characters are used, like \" wheels or display 19\".
When I'm processing that data of course I do not want that these characters are written ro the DB.
So how can I remove these escape-characters in a json-string (processed by the ObjectModelParser)?
I could always use assing ... = replace(json-string value, '\"', '"').
But that's not really a good idea because I would need to do that on every string-value that I get from that json while processing that json (I never know if a value can and will contain this escape-character)
I guess there will be some easy solution to this but I can't find it
Regards
Didier
Hi Otto,
That's what I do.
assign
parser = new ObjectModelParser()
jsonResponse = cast(parser:Parse(mptrOut), JsonObject)
jsonResponse = jsonResponse:GetJsonObject("responseDetails")
jsonResponse = jsonResponse:GetJsonObject("vehicle").
an then I use for example
assign v-INdescription = string(JsonResponse:GetJsonText("itemDescription").
regards
Didier
GetCharacter should give you the unescaped string, GetJsonText gives you the actual text as serialized in JSON.
Arggh, ok that's clear (both suggestions work fine).
Thes tupid thing is that I used those in some other program in the past but tried here with GetJsonText so that I could prevent the check on what datatype a value was. But that was clearly a bad idea because then I have the problem with the escape-character.
No problem, will adjust my code to use jsonObject:Get<depends on datatype>
Thanks