Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
srp_jsonX_parse
I have an issue where sometimes users use [] in text and thus cause a parser error.
should this error really be occurring. If on first line it does not appear to get an error. I understand that [] is a json thing, but, i thought there must be someway the parser can distinguish the real thing.
Is there a workaround with maybe I have to substitute [] with ().
should this error really be occurring. If on first line it does not appear to get an error. I understand that [] is a json thing, but, i thought there must be someway the parser can distinguish the real thing.
Is there a workaround with maybe I have to substitute [] with ().
Comments
<29> HTTPPostString : {"new_job_details":["swwws
wswsssws
swwss[222]
swsws"],"long":"150.8278272","lat":"-34.4915968","date":"15/09/2022","end_time":"09:00AM","employee":[184],"job_completed_response":"No"}
So, I will have to convert at my end.
Can you tell me what the swap/convert command should look like please.
I assume I can apply it to the full HTTPPostString
Then I assume I will have to convert it back or will the parse do that?
Swap \0D0A\ with "\r\n" in Text
this fixed the issue:
jsonbody = HTTP_Services('DecodePercentString', jsonbody) swap \0D0A\ with '\r\n' in jsonbody swap \0A\ with '\r\n' in jsonbody
only one line so no LineFeed
>>Do you think this was a red herring on your part?
No, definately \0A\ in the string when multilined
When I read this, "If on first line it does not appear to get an error", I took that to mean, "If the [] is on the first line but not on other lines, it does not appear to get an error". What you really meant was "I only have one line and I do not get an error".
Hence, the only problem was the multiline content. The location of [] had no relevance.
The web developer fixed that.
I thought this could be the same issue, but, yes it was a red herring.
Btw: I think fixing the [] caused this error as I am sure it was working in a previous version, but I don't have a very good test bed to check it.
Attached is a log file that has the multiline comments section in the "new_job_details" returned, with CRLF as line separator.
Can I assume then this is EXACTLY what was received and you have not formatted it, because the developer says he can see anything wrong, but, this is not his test data and maybe did not do mutli-line.
Time zone issue so am waiting on a response this afternoon from him.
What actual charactor should I be seeing at this point before the 'DecodePercentString'
Is it a %char
jsonbody = HTTP_Services('GetHTTPPostString')
debug
I see %0A as the LF, which I believe is correct
BUT
jsonbody = HTTP_Services('DecodePercentString', jsonbody)
comes back with \0A\
screenshots attached.