[WebDNA] Escaping content for JSON

This WebDNA talk-list message is from

2013


It keeps the original formatting.
numero = 110276
interpreted = N
texte = --047d7b5daeb86ec28f04d896e7bb Content-Type: text/plain; charset=UTF-8 Hi 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 if anyone else has come up with a cleaner solution. Thanks - Tom Conversion 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][convertwords table=jsonconvert][theTitle][/convertwords][/convertchars]" } --047d7b5daeb86ec28f04d896e7bb Content-Type: text/html; charset=UTF-8 Content-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:

    
  1. Re: [WebDNA] Escaping content for JSON (Stuart Tremain 2016)
  2. Re: [WebDNA] Escaping content for JSON (Tom Duke 2016)
  3. Re: [WebDNA] Escaping content for JSON (Tom Duke 2013)
  4. Re: [WebDNA] Escaping content for JSON (Donovan Brooke 2013)
  5. [WebDNA] Escaping content for JSON (Tom Duke 2013)
--047d7b5daeb86ec28f04d896e7bb Content-Type: text/plain; charset=UTF-8 Hi 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 if anyone else has come up with a cleaner solution. Thanks - Tom Conversion 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][convertwords table=jsonconvert][theTitle][/convertwords][/convertchars]" } --047d7b5daeb86ec28f04d896e7bb Content-Type: text/html; charset=UTF-8 Content-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:

WebDNA Intranet Edition release (2002) Preferred Web Design Tool? (1999) WebCat2b12--[searchstring] bug (1997) test7 (2000) Calculate UnitShipCost in Formulas.db (1999) Webcat deletes last line from Excel-saved text db (2004) Re(2): SSL, WebSTAR, WebCatalog (1998) Database changes (1998) Emailer (1997) RE: [WebDNA] Secure Cookies (2020) Any Unix/Linux version to come? (1999) Pithy questions on webcommerce & siteedit (1997) Search/sort in URL Was: GuestBook example (1997) Not really WebCat (1997) Using [showif] (2000) About that math question ... (2003) Errant Email. (1998) Mem per threads (1998) Formating Tables w/[founditems] (1998) Probably a very simple question? (1997)