Re: [WebDNA] Escaping content for JSON

This WebDNA talk-list message is from

2013


It keeps the original formatting.
numero = 110278
interpreted = N
texte = Tom Duke wrote: > 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]" > } Tom, Here is what I came up with tonight: http://www.euca.us/admin/tests/json_test.html Donovan -- Donovan Brooke WebDNA Software Corporation http://www.webdna.us **[Square Bracket Utopia]** 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)
Tom Duke wrote: > 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]" > } Tom, Here is what I came up with tonight: http://www.euca.us/admin/tests/json_test.html Donovan -- Donovan Brooke WebDNA Software Corporation http://www.webdna.us **[Square Bracket Utopia]** Donovan Brooke

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:

Sorting by date (1997) [CART] inside a [LOOP] (1997) Browser Reloads and AddlineItem (1997) Interactive Docs (2007) [delete] problem (1997) [WebDNA] Mac Question (2018) nested ListWords? (2003) state? (2004) Cyberstudio and WebDNA (1997) Clear/Reset form with JavaScript (2001) Development terminated. (1998) Separate SSL Server (1997) Tax issue (2005) Running 2 two WebCatalog.acgi's (1996) More Discount Pricing thoughts/efforts (1998) cookies (2002) HELP WITH DATES (1997) Trouble with formula.db (1997) searching for items that begin with a number (2004) Client-side Image Maps and WebCat? (1998)