(some samples here >> http://www.jquery4u.com/json/10-example-json-files/)
>> >>>>>> [showif [action]=parse-json]>>>>[text show=T]theJson=[sample-json][/text]
David,
=Hi - have you tried the listwords without the convertchars ?Just to see where the issue is coming from.<=br>- Tom
Sent fr=om my iPhone---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.usBug Reporting: suppo=rt@webdna.us3. result1. conversion tablesteps:Sampl=e output to parse (instagram): HI all, not sure if I am experiencing a bug, or not.I= am parsing a json output. that should be pretty simple.
{"provider_url":"http:\/\/instagram.com\/","media_id":"66116=2059018947119_192009753","title":"Drink a little drink, smoke a little smoke #jack #coke #church=20#whiskeyinthejaro #whiskey #countrymusic=20#outlaw","url":"http:\/\/distilleryimage1.ak.instagram.com<=/a>\/3e92a5949b6a11e39c1412d6a650978d_8.jpg","author_name":&=quot;mitchzorn","height":640,"width":640,"ver=sion":"1.0","author_url":"http:\/\/instagram.com\/mitchzorn"=,"author_id":192009753,"type":"photo","p=rovider_name":"Instagram"}
[table name=3Dclea=nMeJSON&fields=3Dfrom,to]
{=A0=A0=A0
}=A0=A0=A0
"
[/=table]
2. [listwords words=3D[convertchars table=3DcleanMeJSON][theO=utPut][/convertchars]&Delimiters=3D,]
[index] [word]<br />
=A0[/listwords]
1 p=rovider_url:http::///instagram.comm/
=202 media_id:661162059018947119_192009753
=203 title:Drink a little drink
=204 smoke a little smoke #jack #coke #church #whiskeyinthejaro #whiskey #cou=ntrymusic #outlaw
=205 url:http::///distilleryimage1.ak.instagram.comm/3e92a5949b6a11e39c1412d6a=650978d_8.jpg
=206 author_name:mitchzorn
=207 height:640
=208 width:640
=209 version:1.0
=2010 author_url:http::///instagram.comm/mitchzorn
=2011 author_id:192009753
=2012 type:photo
=2013 provider_name:Instagramin part=icular, I have no idea how extra letters are getting into the results.
<=/div>Note the author link: http::///instagram.comm/mitchzornthere is an extra "m" in "comm"
and an extra &q=uot;:" and an extra "/"i noticed this bef=ore on something but thought it was the input - now I see it is not.=
Is there anything that I have done, that should not work?I just compared my output to Tom's Json Parser script:
json=-12-provider_name =3D Instagram
json-11-type =3D photo
json-10-author_id =3D 192009753
json-09-author_url =3D http:\/\/instagram.com\/mitchzorn
json-08-version =3D 1.0
json-07-width =3D 640
json-06-height =3D 640
json-05-author_name =3D mitchzorn
json-04-url =3D http:\/\/distilleryimage1.ak.instagram.com\/3e92a5949b6a11e=39c1412d6a650978d_8.jpg
json-03-title =3D Drink a little drink, smoke a little smoke #jack #coke #c=hurch #whiskeyinthejaro #whiskey #countrymusic #outlaw
json-02-media_id =3D 661162059018947119_192009753
json-01-provider_url =3D http:\/\/instagram.com\/it's d=riving me a little nuts and only just realised that webcat was responsible.= Is this a BUG or operator error?
thanks.
d.---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.usBug Reporting: suppo=rt@webdna.usOn Thu, Feb 20, 2014 at= 5:49 PM, Tom Duke <tom@revolutionaries.ie> wrote:Hi all,=There has been talk on the list in the past about a JSON parser. =A0I have =knocked together a cheap and nasty parser which tries to assign all of the =key:value pairs to WebDNA variables. =A0 You can try it here:It doesn't properly pa=rse the JSON but it might help someone. =A0 The code is below.- Tom[text]debug=3DF[/text]&=lt;h3>Paste some JSON</h3><p>(some samples here &=lt;a href=3D"http://www.jquery4u.com/json/10-example-json-files=/">http://www.jquery4u.com/json/10-example-json-files/=a></a>)</p><form action=3D"[thisurl]" method=3D"post"><=/div><input type=3D"hidden" name=3D"action" val=ue=3D"parse-json" /><textarea name=3D"sampl=e-json" style=3D"width: 50%; height: 200px;" placeholder=3D&=quot;paste some json"></textarea><br /><button>Parse me</button></form> [showif [action]=3Dparse-json]<h3>Sample JSON</h3><pre>[text sh=ow=3DT]theJson=3D[sample-json][/text]</pre><br /><br />=div>[!]<=div>--------------------------=----------### =A0Co=nversion table to strip non-breaking spaces ###[/!][table name=3DjsonClean&fields=3Dfrom,to]=%C2%A0[/table][!]----=--------------------------------### =A0Conversion table to facilitate spliting into key:value =pairs =A0###[/!][table name=3DjsonSplitConversions&fields=3Dfro=m,to]|~~~~\"^^^^ [/tabl=e][!]=span>------------------------------------### =A0Convert back after spliting into key:value pai=rs =A0###[/!][table name=3DjsonSplitConversionsBack&fields==3Dfrom,to]"=div>~~~~|^^^^<=span style=3D"white-space:pre-wrap">"[/table][!]------------------------------------<=span style=3D"white-space:pre-wrap">### =A0pass one - run the conve=rsions =A0###[/!][text]theJson=3D[convertwords table=3DjsonSplitConv=ersions][convertchars table=3DjsonClean][theJson][/convertchars][/convertwo=rds][/text][!]------------------------------------### =A0pass two - add bar= to just before each key:value pair ###[/!][text]=theJson=3D[grep search=3D("[^"]*"):&replace=3D|\1=3D][th=eJson][/grep][/text][!]=span>------------------------------------### =A0pass three - list out the key:value pairs and =assign them to text variables =A0###[/!][text]count=3D0[/text][listwords words=3D[url][theJ=son][/url]&delimiters=3D|{}][!][/!][text]thisVal=3D[grep search=3D(,$)&=replace=3D][getchars start=3D1&trim=3Dboth][convertwords table=3DjsonSp=litConversionsBack][word][/convertwords][/getchars][/grep][/text][!][/!][showif [debug]=3DT][index]. [url][thisV=al][/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][!]----------------------------=-------- ### =A0Let's have a l=ook at the variables =A0###[/!]<h3>JSON Ass=igned to Text Variables</h3>[listvariables name=3Djson-&am=p;exact=3DF][name] =3D [value]<br />[/listvariables][/showif]
--
David B=astedoTen Plus One Communic=ations Inc.
http://=www.10plus1.com
416.277.4499
Ten Plus One Communic=ations Inc.
http://=www.10plus1.com
416.277.4499
|
(some samples here >> http://www.jquery4u.com/json/10-example-json-files/)
>> >>>>>> [showif [action]=parse-json]>>>>[text show=T]theJson=[sample-json][/text]
David,
=Hi - have you tried the listwords without the convertchars ?Just to see where the issue is coming from.<=br>- Tom
Sent fr=om my iPhone---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.usBug Reporting: suppo=rt@webdna.us3. result1. conversion tablesteps:Sampl=e output to parse (instagram): HI all, not sure if I am experiencing a bug, or not.I= am parsing a json output. that should be pretty simple.
{"provider_url":"http:\/\/instagram.com\/","media_id":"66116=2059018947119_192009753","title":"Drink a little drink, smoke a little smoke #jack #coke #church=20#whiskeyinthejaro #whiskey #countrymusic=20#outlaw","url":"http:\/\/distilleryimage1.ak.instagram.com<=/a>\/3e92a5949b6a11e39c1412d6a650978d_8.jpg","author_name":&=quot;mitchzorn","height":640,"width":640,"ver=sion":"1.0","author_url":"http:\/\/instagram.com\/mitchzorn"=,"author_id":192009753,"type":"photo","p=rovider_name":"Instagram"}
[table name=3Dclea=nMeJSON&fields=3Dfrom,to]
{=A0=A0=A0
}=A0=A0=A0
"
[/=table]
2. [listwords words=3D[convertchars table=3DcleanMeJSON][theO=utPut][/convertchars]&Delimiters=3D,]
[index] [word]<br />
=A0[/listwords]
1 p=rovider_url:http::///instagram.comm/
=202 media_id:661162059018947119_192009753
=203 title:Drink a little drink
=204 smoke a little smoke #jack #coke #church #whiskeyinthejaro #whiskey #cou=ntrymusic #outlaw
=205 url:http::///distilleryimage1.ak.instagram.comm/3e92a5949b6a11e39c1412d6a=650978d_8.jpg
=206 author_name:mitchzorn
=207 height:640
=208 width:640
=209 version:1.0
=2010 author_url:http::///instagram.comm/mitchzorn
=2011 author_id:192009753
=2012 type:photo
=2013 provider_name:Instagramin part=icular, I have no idea how extra letters are getting into the results.
<=/div>Note the author link: http::///instagram.comm/mitchzornthere is an extra "m" in "comm"
and an extra &q=uot;:" and an extra "/"i noticed this bef=ore on something but thought it was the input - now I see it is not.=
Is there anything that I have done, that should not work?I just compared my output to Tom's Json Parser script:
json=-12-provider_name =3D Instagram
json-11-type =3D photo
json-10-author_id =3D 192009753
json-09-author_url =3D http:\/\/instagram.com\/mitchzorn
json-08-version =3D 1.0
json-07-width =3D 640
json-06-height =3D 640
json-05-author_name =3D mitchzorn
json-04-url =3D http:\/\/distilleryimage1.ak.instagram.com\/3e92a5949b6a11e=39c1412d6a650978d_8.jpg
json-03-title =3D Drink a little drink, smoke a little smoke #jack #coke #c=hurch #whiskeyinthejaro #whiskey #countrymusic #outlaw
json-02-media_id =3D 661162059018947119_192009753
json-01-provider_url =3D http:\/\/instagram.com\/it's d=riving me a little nuts and only just realised that webcat was responsible.= Is this a BUG or operator error?
thanks.
d.---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.usBug Reporting: suppo=rt@webdna.usOn Thu, Feb 20, 2014 at= 5:49 PM, Tom Duke <tom@revolutionaries.ie> wrote:Hi all,=There has been talk on the list in the past about a JSON parser. =A0I have =knocked together a cheap and nasty parser which tries to assign all of the =key:value pairs to WebDNA variables. =A0 You can try it here:It doesn't properly pa=rse the JSON but it might help someone. =A0 The code is below.- Tom[text]debug=3DF[/text]&=lt;h3>Paste some JSON</h3><p>(some samples here &=lt;a href=3D"http://www.jquery4u.com/json/10-example-json-files=/">http://www.jquery4u.com/json/10-example-json-files/=a></a>)</p><form action=3D"[thisurl]" method=3D"post"><=/div><input type=3D"hidden" name=3D"action" val=ue=3D"parse-json" /><textarea name=3D"sampl=e-json" style=3D"width: 50%; height: 200px;" placeholder=3D&=quot;paste some json"></textarea><br /><button>Parse me</button></form> [showif [action]=3Dparse-json]<h3>Sample JSON</h3><pre>[text sh=ow=3DT]theJson=3D[sample-json][/text]</pre><br /><br />=div><=div>--------------------------=----------### =A0Co=nversion table to strip non-breaking spaces ###[/!][table name=3DjsonClean&fields=3Dfrom,to]=%C2%A0[/table][!]----=--------------------------------### =A0Conversion table to facilitate spliting into key:value =pairs =A0###[/!][table name=3DjsonSplitConversions&fields=3Dfro=m,to]|~~~~\"^^^^ [/tabl=e][!]=span>------------------------------------### =A0Convert back after spliting into key:value pai=rs =A0###[/!][table name=3DjsonSplitConversionsBack&fields==3Dfrom,to]"=div>~~~~|^^^^<=span style=3D"white-space:pre-wrap">"[/table][!]------------------------------------<=span style=3D"white-space:pre-wrap">### =A0pass one - run the conve=rsions =A0###[/!][text]theJson=3D[convertwords table=3DjsonSplitConv=ersions][convertchars table=3DjsonClean][theJson][/convertchars][/convertwo=rds][/text][!]------------------------------------### =A0pass two - add bar= to just before each key:value pair ###=span>------------------------------------### =A0pass three - list out the key:value pairs and =assign them to text variables =A0###[/!][text]thisVal=3D[grep search=3D(,$)&=replace=3D][getchars start=3D1&trim=3Dboth][convertwords table=3DjsonSp=litConversionsBack][word][/convertwords][/getchars][/grep][/text][!][/!]=[text]json-[format .2d][text show=3DT]count=3D[math][count]+1[/math][/text]=[/format]-[thisVal][/text][!][/!][/hideif][!] [/!][/listwords][!]----------------------------=-------- ### =A0Let's have a l=ook at the variables =A0###[/!]<h3>JSON Ass=igned to Text Variables</h3>[listvariables name=3Djson-&am=p;exact=3DF][name] =3D [value]<br />[/listvariables][/showif]
--
David B=astedoTen Plus One Communic=ations Inc.
http://=www.10plus1.com
416.277.4499
Ten Plus One Communic=ations Inc.
http://=www.10plus1.com
416.277.4499
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...