[WebDNA] Escaping content for JSON
This WebDNA talk-list message is from 2013
It keeps the original formatting.
numero = 110276
interpreted = N
texte = --047d7b5daeb86ec28f04d896e7bbContent-Type: text/plain; charset=UTF-8Hi all,Trying to work out the best method of preparing content for use with JSON. My db charset is UTF-8 and it seems I need to use a [convertwords] and a[convertchars] to escape all of the required chars.Double quotes are not captured if I use just [convertchars]. Wondering ifanyone else has come up with a cleaner solution.Thanks- TomConversion tables:[table name=jsonconvert&fields=from,to]" \"\ \\/ \/[/table][table name=jsonconvert2&fields=from,to]%0B \n[/table]JSON output:{"label": "Title:","name": "[convertchars table=jsonconvert2][convertwordstable=jsonconvert][theTitle][/convertwords][/convertchars]"}--047d7b5daeb86ec28f04d896e7bbContent-Type: text/html; charset=UTF-8Content-Transfer-Encoding: quoted-printable
Hi all,
Trying to work out the best method of preparing c=ontent for use with JSON. =C2=A0 My db charset is UTF-8 and it seems I need= to use a [convertwords] and a [convertchars] to escape all of the required= chars.
Double quotes are not captured if I use jus=t [convertchars]. =C2=A0Wondering if anyone else has come up with a cleaner= solution.
Thanks
- To=m
Conversion tables:
[table name=3Djsonconvert&fields==3Dfrom,to]
"=\"
\\\
/\/
[/table]
<=div>
[table name=3Djsonconvert2&fields=3Dfrom,to]
%0B\n[/table]
JSON output:
{
"label": "Title:",
"name": "[convertch=ars table=3Djsonconvert2][convertwords table=3Djsonconvert][theTitle][/conv=ertwords][/convertchars]"
}
--047d7b5daeb86ec28f04d896e7bb--
Associated Messages, from the most recent to the oldest:
--047d7b5daeb86ec28f04d896e7bbContent-Type: text/plain; charset=UTF-8Hi all,Trying to work out the best method of preparing content for use with JSON. My db charset is UTF-8 and it seems I need to use a
[convertwords] and a
[convertchars] to escape all of the required chars.Double quotes are not captured if I use just
[convertchars]. Wondering ifanyone else has come up with a cleaner solution.Thanks- TomConversion tables:[table name=jsonconvert&fields=from,to]" \"\ \\/ \/[/table][table name=jsonconvert2&fields=from,to]%0B \n[/table]JSON output:{"label": "Title:","name": "[convertchars table=jsonconvert2][convertwordstable=jsonconvert][theTitle][/convertwords][/convertchars]"}--047d7b5daeb86ec28f04d896e7bbContent-Type: text/html; charset=UTF-8Content-Transfer-Encoding: quoted-printable
Hi all,
Trying to work out the best method of preparing c=ontent for use with JSON. =C2=A0 My db charset is UTF-8 and it seems I need= to use a
[convertwords] and a
[convertchars] to escape all of the required= chars.
Double quotes are not captured if I use jus=t
[convertchars]. =C2=A0Wondering if anyone else has come up with a cleaner= solution.
Thanks
- To=m
Conversion tables:
[table name=3Djsonconvert&fields==3Dfrom,to]
"=\"
\\\
/\/
[/table]
<=div>
[table name=3Djsonconvert2&fields=3Dfrom,to]
%0B\n[/table]
JSON output:
{
"label": "Title:",
"name": "[convertch=ars table=3Djsonconvert2][convertwords table=3Djsonconvert][theTitle][/conv=ertwords][/convertchars]"
}
--047d7b5daeb86ec28f04d896e7bb--
Tom Duke
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
case sensitivity in lookups (1997)
[ShowIf] and empty fields (1997)
[Fwd: internet tax] (2001)
Yet another db manager (2004)
Roundup (2001)
Realtor Search (2000)
database problem (2003)
date sorting and 'template (1997)
X Server (1999)
setcookie getcookie on the same page (2003)
no global [username] or [password] displayed ... (1997)
showif and cart (1997)
Page Counters? (1997)
Sendmail (SMTP) coming from smithmicro.com (2002)
autosensing lanague selection (1997)
Weird Math (2000)
Cancel Subscription (1996)
Looping through all records (2000)
Displaying text and populating form fields (2005)
Problems appending to database (1997)