WebDNA is a scripting and database system designed to easily build web applications.
WebDNA and BioType
BioType service is a biometric keystroke dynamic system. It will be part of WebDNA 8.5
Download WebDNA
Download WebDNA freeware, try it and register later if you want.
WebDNA resources
The list of all WebDNA instructions.
Menu
What is WebDNA
WebDNA is a scripting and database system designed to easily build web applications.
WebDNA and BioType
BioType service is a biometric keystroke dynamic system. It will be part of WebDNA 8.5
Download WebDNA
Download WebDNA freeware, try it and register later if you want.
WebDNA resources
The list of all WebDNA instructions.
What is WebDNA
WebDNA is a scripting and database system designed to easily build web applications.
WebDNA and BioType
BioType service is a biometric keystroke dynamic system. It will be part of WebDNA 8.5
Download WebDNA
Download WebDNA freeware, try it and register later if you want.
WebDNA resources
The list of all WebDNA instructions.
What is WebDNA
WebDNA is a scripting and database system designed to easily build web applications.
WebDNA and BioType
BioType service is a biometric keystroke dynamic system. It will be part of WebDNA 8.5
Download WebDNA
Download WebDNA freeware, try it and register later if you want.
WebDNA resources
The list of all WebDNA instructions.
WebDNA
Software Corporation
Search WebDNA Site
Menu
HOME
DOWNLOADS
LEARN
EDUCATION
NEWS
COMMUNITY
STORE
SUPPORT
CONTACT
Re: [WebDNA] JSON Parser
This WebDNA talk-list message is from
2014
It keeps the original formatting.
numero = 111237
interpreted = N
texte = --047d7bd6b82865c14404f4f0611aContent-Type: text/plain; charset=ISO-8859-1Yes. It's coming from the conversion somehow. I still can't quite figure itout.On Sat, Mar 15, 2014 at 5:10 AM, Tom Duke wrote:> David,>> Hi - have you tried the listwords without the convertchars ?>> Just to see where the issue is coming from.>> - Tom>>>>> Sent from my iPhone>> On 14 Mar 2014, at 15:42, David Bastedo wrote:>> HI all, not sure if I am experiencing a bug, or not.>> I am parsing a json output. that should be pretty simple.>> Sample output to parse (instagram):>> {"provider_url":"http:\/\/instagram.com\/","media_id":"661162059018947119_192009753","title":"Drink> a little drink, smoke a little smoke #jack #coke #church #whiskeyinthejaro> #whiskey #countrymusic #outlaw","url":"http:\/\/> distilleryimage1.ak.instagram.com> \/3e92a5949b6a11e39c1412d6a650978d_8.jpg","author_name":"mitchzorn","height":640,"width":640,"version":"1.0","author_url":"http:\/\/> instagram.com> \/mitchzorn","author_id":192009753,"type":"photo","provider_name":"Instagram"}>> steps:>> 1. conversion table>> [table name=cleanMeJSON&fields=from,to]> {> }> "> [/table]>> 2. [listwords words=[convertchars> table=cleanMeJSON][theOutPut][/convertchars]&Delimiters=,]> [index] [word] > [/listwords]>> 3. result> 1 provider_url:http::///instagram.comm/> 2 media_id:661162059018947119_192009753> 3 title:Drink a little drink> 4 smoke a little smoke #jack #coke #church #whiskeyinthejaro #whiskey> #countrymusic #outlaw> 5> url:http::///distilleryimage1.ak.instagram.comm/3e92a5949b6a11e39c1412d6a650978d_8.jpg> 6 author_name:mitchzorn> 7 height:640> 8 width:640> 9 version:1.0> 10 author_url:http::///instagram.comm/mitchzorn> 11 author_id:192009753> 12 type:photo> 13 provider_name:Instagram>>>> in particular, I have no idea how extra letters are getting into the> results.> Note the author link: http::///instagram.comm/mitchzorn> there is an extra "m" in "comm"> and an extra ":" and an extra "/">> i noticed this before 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 = Instagram> json-11-type = photo> json-10-author_id = 192009753> json-09-author_url = http:\/\/instagram.com\/mitchzorn> json-08-version = 1.0> json-07-width = 640> json-06-height = 640> json-05-author_name = mitchzorn> json-04-url = http:\/\/distilleryimage1.ak.instagram.com> \/3e92a5949b6a11e39c1412d6a650978d_8.jpg> json-03-title = Drink a little drink, smoke a little smoke #jack #coke> #church #whiskeyinthejaro #whiskey #countrymusic #outlaw> json-02-media_id = 661162059018947119_192009753> json-01-provider_url = http:\/\/instagram.com\/>>> it's driving me a little nuts and only just realised that webcat was> responsible. Is this a BUG or operator error?>> thanks.>> d.>>>> On Thu, Feb 20, 2014 at 5:49 PM, Tom Duke wrote:>>> Hi 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:>>>> https://www.revolutionaries.ie/admin/test-json.tmpl>>>> It doesn't properly parse the JSON but it might help someone. The code>> is below.>>>> - Tom>>>>>>>>>> [text]debug=F[/text]>>>>
>>>>>> [!]>>>>>> ------------------------------------>> ### Conversion table to strip non-breaking spaces ###>>>> [/!][table name=jsonClean&fields=from,to]>> %C2>> %A0>> [/table][!]>>>>>> ------------------------------------>> ### Conversion table to facilitate spliting into key:value pairs ###>>>> [/!][table name=jsonSplitConversions&fields=from,to]>> | ~~~~>> \" ^^^^>> [/table][!]>>>>>> ------------------------------------>> ### Convert back after spliting into key:value pairs ###>>>> [/!][table name=jsonSplitConversionsBack&fields=from,to]>> ">> ~~~~ |>> ^^^^ ">> [/table][!]>>>>>> ------------------------------------>> ### pass one - run the conversions ###>>>> [/!][text]theJson=[convertwords table=jsonSplitConversions][convertchars>> table=jsonClean][theJson][/convertchars][/convertwords][/text][!]>>>>>> ------------------------------------>> ### pass two - add bar to just before each key:value pair ###>>>> [/!][text]theJson=[grep>> search=("[^"]*"):&replace=|\1=][theJson][/grep][/text][!]>>>>>> ------------------------------------>> ### pass three - list out the key:value pairs and assign them to text>> variables ###>>>> [/!][text]count=0[/text][listwords>> words=[url][theJson][/url]&delimiters=|{}][!]>>>> [/!][text]thisVal=[grep search=(,$)&replace=][getchars>> start=1&trim=both][convertwords>> table=jsonSplitConversionsBack][word][/convertwords][/getchars][/grep][/text][!]>> [/!][showif [debug]=T][index]. [url][thisVal][/url] [/showif][!]>> [/!][hideif [url][thisVal][/url]=][!]>> [/!][text]json-[format .2d][text>> show=T]count=[math][count]+1[/math][/text][/format]-[thisVal][/text][!]>> [/!][/hideif][!]>>>> [/!][/listwords][!]>>>>>> ------------------------------------>> ### Let's have a look at the variables ###>>>> [/!]
JSON Assigned to Text Variables
>> [listvariables name=json-&exact=F][name] = [value] >> [/listvariables]>>>> [/showif]>> --------------------------------------------------------- This message is>> sent to you because you are subscribed to the mailing list . To>> unsubscribe, E-mail to: archives:>> http://mail.webdna.us/list/talk@webdna.us Bug Reporting:>> support@webdna.us>>>>> --> David Bastedo>> Ten Plus One Communications Inc.> http://www.10plus1.com> 416.277.4499> --------------------------------------------------------- This message> is sent to you because you are subscribed to the mailing list . To> unsubscribe, E-mail to: archives:> http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us>> --------------------------------------------------------- This message is> sent to you because you are subscribed to the mailing list . To> unsubscribe, E-mail to: archives:> http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us>-- David BastedoTen Plus One Communications Inc.http://www.10plus1.com416.277.4499--047d7bd6b82865c14404f4f0611aContent-Type: text/html; charset=ISO-8859-1Content-Transfer-Encoding: quoted-printable
Yes. It's coming from the conversion so=mehow. I still can't quite figure it out.
=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:
---------------------------------------------------------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.us
---------------------------------------------------------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.us
--047d7bd6b82865c14404f4f0611aContent-Type: text/plain; charset=ISO-8859-1Yes. It's coming from the conversion somehow. I still can't quite figure itout.On Sat, Mar 15, 2014 at 5:10 AM, Tom Duke wrote:> David,>> Hi - have you tried the listwords without the convertchars ?>> Just to see where the issue is coming from.>> - Tom>>>>> Sent from my iPhone>> On 14 Mar 2014, at 15:42, David Bastedo wrote:>> HI all, not sure if I am experiencing a bug, or not.>> I am parsing a json output. that should be pretty simple.>> Sample output to parse (instagram):>> {"provider_url":"http:\/\/instagram.com\/","media_id":"661162059018947119_192009753","title":"Drink> a little drink, smoke a little smoke #jack #coke #church #whiskeyinthejaro> #whiskey #countrymusic #outlaw","url":"http:\/\/> distilleryimage1.ak.instagram.com> \/3e92a5949b6a11e39c1412d6a650978d_8.jpg","author_name":"mitchzorn","height":640,"width":640,"version":"1.0","author_url":"http:\/\/> instagram.com> \/mitchzorn","author_id":192009753,"type":"photo","provider_name":"Instagram"}>> steps:>> 1. conversion table>> [table name=cleanMeJSON&fields=from,to]> {> }> "> [/table]>> 2. [listwords words=[convertchars> table=cleanMeJSON][theOutPut][/convertchars]&Delimiters=,]> [index] [word] > [/listwords]>> 3. result> 1 provider_url:http::///instagram.comm/> 2 media_id:661162059018947119_192009753> 3 title:Drink a little drink> 4 smoke a little smoke #jack #coke #church #whiskeyinthejaro #whiskey> #countrymusic #outlaw> 5> url:http::///distilleryimage1.ak.instagram.comm/3e92a5949b6a11e39c1412d6a650978d_8.jpg> 6 author_name:mitchzorn> 7 height:640> 8 width:640> 9 version:1.0> 10 author_url:http::///instagram.comm/mitchzorn> 11 author_id:192009753> 12 type:photo> 13 provider_name:Instagram>>>> in particular, I have no idea how extra letters are getting into the> results.> Note the author link: http::///instagram.comm/mitchzorn> there is an extra "m" in "comm"> and an extra ":" and an extra "/">> i noticed this before 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 = Instagram> json-11-type = photo> json-10-author_id = 192009753> json-09-author_url = http:\/\/instagram.com\/mitchzorn> json-08-version = 1.0> json-07-width = 640> json-06-height = 640> json-05-author_name = mitchzorn> json-04-url = http:\/\/distilleryimage1.ak.instagram.com> \/3e92a5949b6a11e39c1412d6a650978d_8.jpg> json-03-title = Drink a little drink, smoke a little smoke #jack #coke> #church #whiskeyinthejaro #whiskey #countrymusic #outlaw> json-02-media_id = 661162059018947119_192009753> json-01-provider_url = http:\/\/instagram.com\/>>> it's driving me a little nuts and only just realised that webcat was> responsible. Is this a BUG or operator error?>> thanks.>> d.>>>> On Thu, Feb 20, 2014 at 5:49 PM, Tom Duke wrote:>>> Hi 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:>>>> https://www.revolutionaries.ie/admin/test-json.tmpl>>>> It doesn't properly parse the JSON but it might help someone. The code>> is below.>>>> - Tom>>>>>>>>>> [text]debug=F[/text]>>>>
>>>>>> [!]>>>>>> ------------------------------------>> ### Conversion table to strip non-breaking spaces ###>>>> [/!][table name=jsonClean&fields=from,to]>> %C2>> %A0>> [/table][!]>>>>>> ------------------------------------>> ### Conversion table to facilitate spliting into key:value pairs ###>>>> [/!][table name=jsonSplitConversions&fields=from,to]>> | ~~~~>> \" ^^^^>> [/table][!]>>>>>> ------------------------------------>> ### Convert back after spliting into key:value pairs ###>>>> [/!][table name=jsonSplitConversionsBack&fields=from,to]>> ">> ~~~~ |>> ^^^^ ">> [/table][!]>>>>>> ------------------------------------>> ### pass one - run the conversions ###>>>> [/!][text]theJson=[convertwords table=jsonSplitConversions][convertchars>> table=jsonClean][theJson][/convertchars][/convertwords][/text][!]>>>>>> ------------------------------------>> ### pass two - add bar to just before each key:value pair ###>>>> [/!][text]theJson=[grep>> search=("[^"]*"):&replace=|\1=][theJson][/grep][/text][!]>>>>>> ------------------------------------>> ### pass three - list out the key:value pairs and assign them to text>> variables ###>>>> [/!][text]count=0[/text][listwords>> words=[url][theJson][/url]&delimiters=|{}][!]>>>> [/!][text]thisVal=[grep search=(,$)&replace=][getchars>> start=1&trim=both][convertwords>> table=jsonSplitConversionsBack][word][/convertwords][/getchars][/grep][/text][!]>> [/!][showif [debug]=T][index]. [url][thisVal][/url] [/showif][!]>> [/!][hideif [url][thisVal][/url]=][!]>> [/!][text]json-[format .2d][text>> show=T]count=[math][count]+1[/math][/text][/format]-[thisVal][/text][!]>> [/!][/hideif][!]>>>> [/!][/listwords][!]>>>>>> ------------------------------------>> ### Let's have a look at the variables ###>>>> [/!]
JSON Assigned to Text Variables
>> [listvariables name=json-&exact=F][name] = [value] >> [/listvariables]>>>> [/showif]>> --------------------------------------------------------- This message is>> sent to you because you are subscribed to the mailing list . To>> unsubscribe, E-mail to: archives:>> http://mail.webdna.us/list/talk@webdna.us Bug Reporting:>> support@webdna.us>>>>> --> David Bastedo>> Ten Plus One Communications Inc.> http://www.10plus1.com> 416.277.4499> --------------------------------------------------------- This message> is sent to you because you are subscribed to the mailing list . To> unsubscribe, E-mail to: archives:> http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us>> --------------------------------------------------------- This message is> sent to you because you are subscribed to the mailing list . To> unsubscribe, E-mail to: archives:> http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us>-- David BastedoTen Plus One Communications Inc.http://www.10plus1.com416.277.4499--047d7bd6b82865c14404f4f0611aContent-Type: text/html; charset=ISO-8859-1Content-Transfer-Encoding: quoted-printable
Yes. It's coming from the conversion so=mehow. I still can't quite figure it out.
=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:
---------------------------------------------------------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.us
---------------------------------------------------------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.us
---------------------------------------------------------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.us
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...