What is WebDNA
WebDNA and BioType
Download WebDNA
WebDNA resources
What is WebDNA
WebDNA and BioType
Download WebDNA
WebDNA resources
What is WebDNA
WebDNA and BioType
Download WebDNA
WebDNA resources
What is WebDNA
WebDNA and BioType
Download WebDNA
WebDNA resources
(some samples here http://www.jq=uery4u.com/json/10-example-json-files/)
>> >>=20>>=20>> [showif [action]=3Dparse-json]>>=20>>[text show=3DT]theJson=3D[sample-json][/text]
--------------------------------------------------------- =This message is sent to you because you are subscribed to the mailing =list <talk@webdna.us>. To =unsubscribe, E-mail to: <talk-leave@webdna.us>archives:= http://mail.webdna.us/l=ist/talk@webdna.us Bug Reporting: support@webdna.us--- Original message ---
Subject: [WebDNA] JSON Parser
From: Tom Duke <tom@revolutionaries.ie>
To: talk@webdna.us <talk@webdna.us>
Date: Thursday, 20/02/2014 4:48 =PMHi all,There has been talk on the =list in the past about a JSON parser. I have knocked together a =cheap and nasty parser which tries to assign all of the key:value pairs =to WebDNA variables. You can try it =here:It =doesn't properly parse the JSON but it might help someone. The =code is below.- =Tom=[text]debug=3DF[/text]<h3>Paste =some JSON</h3><p>(some samples here <a =href=3D"http://www.jq=uery4u.com/json/10-example-json-files/">http://www.jq=uery4u.com/json/10-example-json-files/</a>)</p>=<form action=3D"[thisurl]" method=3D"post"><input =type=3D"hidden" name=3D"action" value=3D"parse-json" =/><textarea name=3D"sample-json" style=3D"width: 50%; =height: 200px;" placeholder=3D"paste some =json"></textarea><br /><button>Parse =me</button></form>[showif =[action]=3Dparse-json]<h3>Sample =JSON</h3><pre>[text =show=3DT]theJson=3D[sample-json][/text]</pre><br /><br =/>[!]=------------------------------------### Conversion table to =strip non-breaking spaces ###[/!][table =name=3DjsonClean&fields=3Dfrom,to]%C2%A0=[/table][!]=------------------------------------ ### Conversion table to =facilitate spliting into key:value pairs = ###[/!][table =name=3DjsonSplitConversions&fields=3Dfrom,to]|~~~~\"=^^^^[/table][!]==------------------------------------### Convert back after =spliting into key:value pairs = ###[/!][table =name=3DjsonSplitConversionsBack&fields=3Dfrom,to]"~~~~|^^^^="[/table][!]=------------------------------------ ### pass one - run the =conversions = ###[/!][text]theJson=3D[convertwords =table=3DjsonSplitConversions][convertchars =table=3DjsonClean][theJson][/convertchars][/convertwords][/text][!]<=div>------------------------------------### pass two - add =bar to just before each key:value pair =###[/!][text]theJson=3D[grep =search=3D("[^"]*"):&replace=3D|\1=3D][theJson][/grep][/text][!]<=div>------------------------------------### pass three - =list out the key:value pairs and assign them to text variables = ###[/!][text]count=3D0[/text][listwords =words=3D[url][theJson][/url]&delimiters=3D|{}][!]==[/!][text]thisVal=3D[grep search=3D(,$)&replace=3D][getchars =start=3D1&trim=3Dboth][convertwords =table=3DjsonSplitConversionsBack][word][/convertwords][/getchars][/grep][/=text][!]==[/!][showif [debug]=3DT][index]. [url][thisVal][/url]<br =/>[/showif][!]=[/!][hideif [url][thisVal][/url]=3D][!][/!][text]json-[format =.2d][text =show=3DT]count=3D[math][count]+1[/math][/text][/format]-[thisVal][/text][!=]=[/!][/hideif][!][/!][/listwords][!]=------------------------------------### Let's have a =look at the variables = ###[/!]<h3>JSON Assigned to Text =Variables</h3>[listvariables =name=3Djson-&exact=3DF][name] =3D [value]<br =/>[/listvariables][/showif]<=/div>
|
(some samples here http://www.jq=uery4u.com/json/10-example-json-files/)
>> >>=20>>=20>> [showif [action]=3Dparse-json]>>=20>>[text show=3DT]theJson=3D[sample-json][/text]
--------------------------------------------------------- =This message is sent to you because you are subscribed to the mailing =list <talk@webdna.us>. To =unsubscribe, E-mail to: <talk-leave@webdna.us>archives:= http://mail.webdna.us/l=ist/talk@webdna.us Bug Reporting: support@webdna.us--- Original message ---
Subject: [WebDNA] JSON Parser
From: Tom Duke <tom@revolutionaries.ie>
To: talk@webdna.us <talk@webdna.us>
Date: Thursday, 20/02/2014 4:48 =PMHi all,There has been talk on the =list in the past about a JSON parser. I have knocked together a =cheap and nasty parser which tries to assign all of the key:value pairs =to WebDNA variables. You can try it =here:It =doesn't properly parse the JSON but it might help someone. The =code is below.- =Tom=[text]debug=3DF[/text]<h3>Paste =some JSON</h3><p>(some samples here <a =href=3D"http://www.jq=uery4u.com/json/10-example-json-files/">http://www.jq=uery4u.com/json/10-example-json-files/</a>)</p>=<form action=3D"[thisurl]" method=3D"post"><input =type=3D"hidden" name=3D"action" value=3D"parse-json" =/><textarea name=3D"sample-json" style=3D"width: 50%; =height: 200px;" placeholder=3D"paste some =json"></textarea><br /><button>Parse =me</button></form>[showif =[action]=3Dparse-json]<h3>Sample =JSON</h3><pre>[text =show=3DT]theJson=3D[sample-json][/text]</pre><br /><br =/>=------------------------------------### Conversion table to =strip non-breaking spaces ###[/!][table =name=3DjsonClean&fields=3Dfrom,to]%C2%A0=[/table][!]=------------------------------------ ### Conversion table to =facilitate spliting into key:value pairs = ###[/!][table =name=3DjsonSplitConversions&fields=3Dfrom,to]|~~~~\"=^^^^[/table][!]==------------------------------------### Convert back after =spliting into key:value pairs = ###[/!][table =name=3DjsonSplitConversionsBack&fields=3Dfrom,to]"~~~~|^^^^="[/table][!]=------------------------------------ ### pass one - run the =conversions = ###[/!][text]theJson=3D[convertwords =table=3DjsonSplitConversions][convertchars =table=3DjsonClean][theJson][/convertchars][/convertwords][/text][!]<=div>------------------------------------### pass two - add =bar to just before each key:value pair =###<=div>------------------------------------### pass three - =list out the key:value pairs and assign them to text variables = ###==[/!][text]thisVal=3D[grep search=3D(,$)&replace=3D][getchars =start=3D1&trim=3Dboth][convertwords =table=3DjsonSplitConversionsBack][word][/convertwords][/getchars][/grep][/=text][!]=[/!][text]json-[format =.2d][text =show=3DT]count=3D[math][count]+1[/math][/text][/format]-[thisVal][/text][!=]=[/!][/hideif][!][/!][/listwords][!]=------------------------------------### Let's have a =look at the variables = ###[/!]<h3>JSON Assigned to Text =Variables</h3>[listvariables =name=3Djson-&exact=3DF][name] =3D [value]<br =/>[/listvariables][/showif]<=/div>
DOWNLOAD WEBDNA NOW!
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...