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

This section covers the Meteobridge PRO, PRO2, NANO SD, Raspberry Pi and VM platforms exclusively

Moderator: Mattk

Post Reply
36260
Expert Boarder
Expert Boarder
Posts: 91
Joined: Sun Feb 17, 2008 11:17 am
Location: Saint Pierre de Jards - France

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

Post 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
Davis VP2 + Solar - Nano SD
User avatar
wvdkuil
Platinum Boarder
Platinum Boarder
Posts: 604
Joined: Sun Jul 24, 2011 8:00 pm
Location: Belgium
Contact:

Re: HTTP event: how to escape double quote

Post 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
36260
Expert Boarder
Expert Boarder
Posts: 91
Joined: Sun Feb 17, 2008 11:17 am
Location: Saint Pierre de Jards - France

Re: HTTP event: how to escape double quote

Post by 36260 »

Thank you so much, it did work.
Davis VP2 + Solar - Nano SD
Post Reply