(some samples here ">http://www.jquery4u=..com/json/10-example-json-files/ =
[text show=3DT]theJson=3D[sample-json][/text]
On 19 Dec 2017, at 20:23, Tom Duke <tom@revolutionaries.ie> wrote:Hi all,Here is the code I use to deal with JSON.- TomFirst a =function to pull a value when you know what JSON node you =want:[!]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++FUNCTION Name: smGetJsonValue** Description: Pull =out a value from a JSONobject** =Input:jsonObject =3D (the =json to be parsed) - required=jsonNode =3D (the node that we the value of) - required** =usage:[smGetJsonValue =jsonObject=3D[url]<the-json-object>[/url]&jsonNode=3D<the-jso=n-node>][/!][function =name=3DsmGetJsonValue][!][/!][text]tReturn=3D[/text][!]=[/!][text]tJsonObject=3D[/text][!]=[/!][text]tJsonNode=3Dnull[/text][!][/!][showif =[url][params_string][/url]^jsonObject][text]tJsonObject=3D[jsonObject][/te=xt][/showif][!][/!][showif =[url][params_string][/url]^jsonNode][text]tJsonNode=3D[jsonNode][/text][/s=howif][!]=### Store the jsonObject in a table = ###[/!][jsonstore =table=3DjsonOject][tJsonObject][/jsonstore][!]### Search the table = ###[/!][search =table=3DjsonOject&ne[tJsonNode]data=3Dfind_all][founditems][!]<=/div>=[/!][text]tReturn=3D[interpret][[tJsonNode]][/interpret][/text][!]<=/font>[/!][/founditems][/search][!]=### Return the value ###[/!][return][tReturn][/return][!][/!][/function]Second a Json parser, that's a bit of a hack:[text]debug=3DF[/text]<h3>Paste =some JSON</h3><p>(some samples here <a href=3D"http://www.jquery4u.com/json/10-example-json-files/">http://www.jquery4u.com/json/10-example-json-files/</a&g=t;)</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][!]==------------------------------------=### pass two - add bar to just before each key:value pair =###[/!][text]theJson=3D[grep =search=3D("[^"]*"):&replace=3D|\1=3D][theJson][/grep][/text][!]==------------------------------------=### 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]---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list talk@webdna.usTo unsubscribe, E-mail to: talk-leave@webdna.usarchives: http://www.webdna.us/page.dna?numero=3D55Bug Reporting: support@webdna.us=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D
Digital Revolutionaries
1st Floor, =Castleriver House
14-15 Parliament Street
Temple Bar,Dublin 2
Ireland
----------------------------------------------
[t]: + 353 1 4403907
[e]: <mailto:tom@revolutionaries.ie>
[w]: <http://www.revolutionaries.ie/>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=On 19 December 2017 at 08:01, =Terry Nair <terrynair@prism4u.com> wrote:Kindly point out the link where I can find that JSON wonder ==E2=80=A6need it for a project. Cannot seem to trace it =E2=80=A6my poor =old eyes are not as good as they used to be =E2=80=A6=F0=9F=98=89
Cheers TDn
From: Stuart Tremain [mailto:webdna@idfk.com.au]
Sent: Tuesday, December 19, 2017 08:19 AM
To: WebDNA Talk List <talk@webdna.us>
Subject: Re: [WebDNA] TCPconnect and Bitcoin rate
OK, =thanks.
Tom if =that was you - nice job, have been using it for a few years now :)
On 19 Dec 2017, at 11:15, Michael =Davis <admin@network13.net> wrote:
Stuart,
I think =that was Tom. He had worked one up prior to JSONStore.
Mike
On Dec 18, 2017, at 3:32 PM, Stuart =Tremain <webdna@idfk.com.au> wrote:
Michael
Were you =the person that did the JSON parser some time ago ?
On 19 Dec 2017, at 10:22, Michael =Davis <admin@network13.net> wrote:
Yariv,
Here's a =starting point for you...
Had to use [middle] to get rid of some garbage, =which was strange. Other than that, it should be pretty straight =forward.
------------------------------
--------------------------- 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://www.webdna.us/page.dna? numero=3D55 =Bug Reporting: support@webdna.us<bitcoin_price.dna>
On Dec 17, 2017, at 3:54 AM, Office =<yariv.n@gmail.com> wrote:
For the last 20 years i never had to receive data =from elsewhere till today.
I need to ask an API for the bitcoin =rate
i wanted to use the TCPconnect for this but the =sample is dead ? :
http://www.webdna.us/page.dna?
numero=3D264 <=u class=3D"">
What i =need is a piece of code to get the USD =E2=80=9Crate" out of this thing =(this number: 19,681.9725) so i can calculate the price of the product =to be divided to this to be able to show the current price in Bitcoin at =my store
{"USD":{"code":"USD","symbol":"$","rate":"19,681.9725"," description":"United States Dollar","rate_float":19681. 9725} This is where it update every second =(or less)
Or any other way to get a rate into my page :-)
Yours,
Yariv =Nachshon
------------------------------
--------------------------- 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://www.webdna.us/page.dna? numero=3D55 =Bug Reporting: support@webdna.us
------------------------------
--------------------------- 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://www.webdna.us/page.dna? numero=3D55 =Bug Reporting: support@webdna.us
------------------------------
--------------------------- 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://www.webdna.us/page.dna? numero=3D55 =Bug Reporting: support@webdna.us
------------------------------
--------------------------- 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://www.webdna.us/page.dna? numero=3D55 =Bug Reporting: support@webdna.us---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list talk@webdna.usTo unsubscribe, E-mail to: talk-leave@webdna.usarchives: http://www.webdna.us/page.dna? numero=3D55 Bug Reporting: support@webdna.us
(some samples here ">http://www.jquery4u=..com/json/10-example-json-files/ =
[text show=3DT]theJson=3D[sample-json][/text]
On 19 Dec 2017, at 20:23, Tom Duke <tom@revolutionaries.ie> wrote:Hi all,Here is the code I use to deal with JSON.- TomFirst a =function to pull a value when you know what JSON node you =want:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++FUNCTION Name: smGetJsonValue** Description: Pull =out a value from a JSONobject** =Input:jsonObject =3D (the =json to be parsed) - required=jsonNode =3D (the node that we the value of) - required** =usage:[smGetJsonValue =jsonObject=3D[url]<the-json-object>[/url]&jsonNode=3D<the-jso=n-node>][/!][function =name=3DsmGetJsonValue][!][/!][showif =[url][params_string][/url]^jsonObject][text]tJsonObject=3D[jsonObject][/te=xt][/showif][!]=### Store the jsonObject in a table = ###[/!][jsonstore =table=3DjsonOject][tJsonObject][/jsonstore][!]### Search the table = ###[/!][search =table=3DjsonOject&ne[tJsonNode]data=3Dfind_all][founditems][!]<=/div>[/!][/founditems][/search][!]=### Return the value ###[/!][/function]Second a Json parser, that's a bit of a hack:[text]debug=3DF[/text]<h3>Paste =some JSON</h3><p>(some samples here <a href=3D"http://www.jquery4u.com/json/10-example-json-files/">http://www.jquery4u.com/json/10-example-json-files/</a&g=t;)</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][!]==------------------------------------=### pass two - add bar to just before each key:value pair =###=------------------------------------=### 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]---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list talk@webdna.usTo unsubscribe, E-mail to: talk-leave@webdna.usarchives: http://www.webdna.us/page.dna?numero=3D55Bug Reporting: support@webdna.us=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D
Digital Revolutionaries
1st Floor, =Castleriver House
14-15 Parliament Street
Temple Bar,Dublin 2
Ireland
----------------------------------------------
[t]: + 353 1 4403907
[e]: <mailto:tom@revolutionaries.ie>
[w]: <http://www.revolutionaries.ie/>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=On 19 December 2017 at 08:01, =Terry Nair <terrynair@prism4u.com> wrote:Kindly point out the link where I can find that JSON wonder ==E2=80=A6need it for a project. Cannot seem to trace it =E2=80=A6my poor =old eyes are not as good as they used to be =E2=80=A6=F0=9F=98=89
Cheers TDn
From: Stuart Tremain [mailto:webdna@idfk.com.au]
Sent: Tuesday, December 19, 2017 08:19 AM
To: WebDNA Talk List <talk@webdna.us>
Subject: Re: [WebDNA] TCPconnect and Bitcoin rate
OK, =thanks.
Tom if =that was you - nice job, have been using it for a few years now :)
On 19 Dec 2017, at 11:15, Michael =Davis <admin@network13.net> wrote:
Stuart,
I think =that was Tom. He had worked one up prior to JSONStore.
Mike
On Dec 18, 2017, at 3:32 PM, Stuart =Tremain <webdna@idfk.com.au> wrote:
Michael
Were you =the person that did the JSON parser some time ago ?
On 19 Dec 2017, at 10:22, Michael =Davis <admin@network13.net> wrote:
Yariv,
Here's a =starting point for you...
Had to use [middle] to get rid of some garbage, =which was strange. Other than that, it should be pretty straight =forward.
------------------------------
--------------------------- 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://www.webdna.us/page.dna? numero=3D55 =Bug Reporting: support@webdna.us<bitcoin_price.dna>
On Dec 17, 2017, at 3:54 AM, Office =<yariv.n@gmail.com> wrote:
For the last 20 years i never had to receive data =from elsewhere till today.
I need to ask an API for the bitcoin =rate
i wanted to use the TCPconnect for this but the =sample is dead ? :
http://www.webdna.us/page.dna?
numero=3D264 <=u class=3D"">
What i =need is a piece of code to get the USD =E2=80=9Crate" out of this thing =(this number: 19,681.9725) so i can calculate the price of the product =to be divided to this to be able to show the current price in Bitcoin at =my store
{"USD":{"code":"USD","symbol":"$","rate":"19,681.9725"," description":"United States Dollar","rate_float":19681. 9725} This is where it update every second =(or less)
Or any other way to get a rate into my page :-)
Yours,
Yariv =Nachshon
------------------------------
--------------------------- 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://www.webdna.us/page.dna? numero=3D55 =Bug Reporting: support@webdna.us
------------------------------
--------------------------- 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://www.webdna.us/page.dna? numero=3D55 =Bug Reporting: support@webdna.us
------------------------------
--------------------------- 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://www.webdna.us/page.dna? numero=3D55 =Bug Reporting: support@webdna.us
------------------------------
--------------------------- 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://www.webdna.us/page.dna? numero=3D55 =Bug Reporting: support@webdna.us---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list talk@webdna.usTo unsubscribe, E-mail to: talk-leave@webdna.usarchives: http://www.webdna.us/page.dna? numero=3D55 Bug Reporting: support@webdna.us
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...