Page 1 of 1

HTTP event: how to escape double quote **solved**

Posted: Tue Oct 13, 2020 6:31 pm
by 36260
Hello,
I have to send an HTTP event with some JSON formatted data, like this:

Code: Select all

http://IP/json.htm?param=customevent&type=command&event=meteobridgeWind&data={"wind" : [wind0wind-act.1], "windDir" : [wind0dir-act] }
When Save is hit, double quote is removed. I tried without success several escape sequences in order to get double quote transmitted in order to have valid JSON data. Single quote is removed as well
Is anybody having a clue?
Thank you

Re: HTTP event: how to escape double quote

Posted: Tue Oct 13, 2020 10:18 pm
by wvdkuil
36260 wrote: Tue Oct 13, 2020 6:31 pm Hello,
I have to send an HTTP event with some JSON formatted data, like this:

Code: Select all

http://IP/json.htm?param=customevent&type=command&event=meteobridgeWind&data={"wind" : [wind0wind-act.1], "windDir" : [wind0dir-act] }
When Save is hit, double quote is removed. I tried without success several escape sequences in order to get double quote transmitted in order to have valid JSON data. Single quote is removed as well
Is anybody having a clue?
Thank you
You could try to encode the " in the json part

Code: Select all

{"wind" : [wind0wind-act.1], "windDir" : [wind0dir-act] }
to

Code: Select all

{%22wind%22 : [wind0wind-act.1], %22windDir%22 : [wind0dir-act] }
Sometimes this seems to help.
Wim

Re: HTTP event: how to escape double quote

Posted: Tue Oct 13, 2020 10:22 pm
by 36260
Thank you so much, it did work.