Re: [WebDNA] TCPconnect and Bitcoin rate

This WebDNA talk-list message is from

2019


It keeps the original formatting.
numero = 114569
interpreted = N
texte = 2189 --Apple-Mail=_2665155C-BB75-4F13-B152-AA3464A99BCF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Michael The issue was with the pipes that are delivered in the JSON from PayPal = (see example below) making the JSON invalid. Filter out the pipes and then I think that you will have success. Kind regards Stuart Tremain Pharoah Lane Software AUSTRALIA webdna@plsoftware.com.au {|"scope"=3D"https://uri.paypal.com/services/subscriptions = https://api.paypal.com/v1/payments/.* = https://api.paypal.com/v1/vault/credit-card = https://uri.paypal.com/services/applications/webhooks openid = https://uri.paypal.com/payments/payouts = https://api.paypal.com/v1/vault/credit-card/.*",|"nonce"=3D"2017-12-20T01:= 06:04ZQKkA0EqAQJMZ-5WtU__vmXZfOfpp5pyU6RBx6suQSYI",|"access_token"=3D"A21A= AG0Ri46F4YVxWcTUR7WO_rekJ0DbA",|"token_type"=3D"Bearer",|"app_id"=3D"APP-8= 0W284485P519543T",|"expires_in"=3D31902} > On 26 Apr 2019, at 08:35, Michael Davis wrote: >=20 > Stuart, >=20 > Does this problem involve ampersands? >=20 > MD >=20 >> On Dec 19, 2017, at 6:58 PM, Stuart Tremain > wrote: >>=20 >> There is a little problem with [JSONstore] when working with PayPal = that I found today. >>=20 >> I have advised WebDNA, hopefully they will do a fix for it. >>=20 >>=20 >> Kind regards >>=20 >> Stuart Tremain >> Pharoah Lane Software >> AUSTRALIA >> webdna@idfk.com.au >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>> On 20 Dec 2017, at 13:47, Brian Harrington > wrote: >>>=20 >>> I put that code on a page... was missing a showif... fixed that. You = have an example of a paste...? >>>=20 >>> On Tue, Dec 19, 2017 at 4:48 PM, Stuart Tremain > wrote: >>> Hey Tom >>>=20 >>> Nice function :) >>>=20 >>>=20 >>> Kind regards >>>=20 >>> Stuart Tremain >>> Pharoah Lane Software >>> AUSTRALIA >>> webdna@idfk.com.au >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>> On 19 Dec 2017, at 20:23, Tom Duke > wrote: >>>>=20 >>>> Hi all, >>>>=20 >>>> Here is the code I use to deal with JSON. >>>>=20 >>>> - Tom >>>>=20 >>>>=20 >>>>=20 >>>> First a function to pull a value when you know what JSON node you = want: >>>>=20 >>>> [!] >>>>=20 >>>>=20 >>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >>>> FUNCTION Name: smGetJsonValue >>>> ** Description: Pull out a value from a JSONobject >>>> ** Input:=20 >>>> jsonObject =3D (the json to be parsed) - required >>>> jsonNode =3D (the node that we the value of) - required >>>> ** usage:=20 >>>> [smGetJsonValue = jsonObject=3D[url][/url]&jsonNode=3D] >>>>=20 >>>> [/!][function name=3DsmGetJsonValue][!] >>>> [/!][text]tReturn=3D[/text][!] >>>>=20 >>>> [/!][text]tJsonObject=3D[/text][!] >>>> [/!][text]tJsonNode=3Dnull[/text][!] >>>>=20 >>>> [/!][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][!] >>>>=20 >>>> ### Store the jsonObject in a table ### >>>>=20 >>>> [/!][jsonstore table=3DjsonOject][tJsonObject][/jsonstore][!] >>>>=20 >>>> ### Search the table ### >>>>=20 >>>> [/!][search = table=3DjsonOject&ne[tJsonNode]data=3Dfind_all][founditems][!] >>>>=20 >>>> [/!][text]tReturn=3D[interpret][[tJsonNode]][/interpret][/text][!]= >>>>=20 >>>> [/!][/founditems][/search][!] >>>>=20 >>>> ### Return the value ### >>>>=20 >>>> [/!][return][tReturn][/return][!] >>>> [/!][/function] >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> Second a Json parser, that's a bit of a hack: >>>>=20 >>>> [text]debug=3DF[/text] >>>>=20 >>>>

Paste some JSON

>>>>

(some samples here ">http://www.jquery4u= ..com/json/10-example-json-files/ = )

>>>>
>>>> >>>>
>>>> >>>>
>>>>=20 >>>>=20 >>>> [showif [action]=3Dparse-json] >>>>=20 >>>>

Sample JSON

>>>>
[text show=3DT]theJson=3D[sample-json][/text]


>>>>=20 >>>>=20 >>>> [!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### Conversion table to strip non-breaking spaces ### >>>>=20 >>>> [/!][table name=3DjsonClean&fields=3Dfrom,to] >>>> %C2=09 >>>> %A0=09 >>>> [/table][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### Conversion table to facilitate spliting into key:value = pairs ### >>>>=20 >>>> [/!][table name=3DjsonSplitConversions&fields=3Dfrom,to] >>>> |~~~~ >>>> \"^^^^ >>>> [/table][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### Convert back after spliting into key:value pairs ### >>>>=20 >>>> [/!][table name=3DjsonSplitConversionsBack&fields=3Dfrom,to] >>>> "=09 >>>> ~~~~| >>>> ^^^^" >>>> [/table][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### pass one - run the conversions ### >>>>=20 >>>> [/!][text]theJson=3D[convertwords = table=3DjsonSplitConversions][convertchars = table=3DjsonClean][theJson][/convertchars][/convertwords][/text][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### pass two - add bar to just before each key:value pair ### >>>>=20 >>>> [/!][text]theJson=3D[grep = search=3D("[^"]*"):&replace=3D|\1=3D][theJson][/grep][/text][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### pass three - list out the key:value pairs and assign them = to text variables ### >>>>=20 >>>> [/!][text]count=3D0[/text][listwords = words=3D[url][theJson][/url]&delimiters=3D|{}][!] >>>>=20 >>>> [/!][text]thisVal=3D[grep search=3D(,$)&replace=3D][getchars = start=3D1&trim=3Dboth][convertwords = table=3DjsonSplitConversionsBack][word][/convertwords][/getchars][/grep][/= text][!] >>>> =09 >>>> [/!][showif [debug]=3DT][index]. [url][thisVal][/url]
[/showif][!] >>>> =09 >>>> [/!][hideif [url][thisVal][/url]=3D][!] >>>> [/!][text]json-[format .2d][text = show=3DT]count=3D[math][count]+1[/math][/text][/format]-[thisVal][/text][!= ] >>>> [/!][/hideif][!] >>>>=20 >>>> [/!][/listwords][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### Let's have a look at the variables ### >>>>=20 >>>> [/!]

JSON Assigned to Text Variables

>>>> [listvariables name=3Djson-&exact=3DF][name] =3D [value]
>>>> [/listvariables] >>>>=20 >>>> [/showif] >>>>=20 >>>>=20 >>>>=20 >>>> =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]: > >>>> [w]: > >>>> =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 >>>>=20 >>>> On 19 December 2017 at 08:01, Terry Nair > wrote: >>>> Kindly point out the link where I can find that JSON wonder =E2=80=A6= need 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 >>>>=20 >>>> =20 >>>>=20 >>>> Cheers TDn >>>>=20 >>>> =C2=A0 <> >>>> From: Stuart Tremain [mailto:webdna@idfk.com.au = ]=20 >>>> Sent: Tuesday, December 19, 2017 08:19 AM >>>> To: WebDNA Talk List > >>>> Subject: Re: [WebDNA] TCPconnect and Bitcoin rate >>>>=20 >>>> =20 >>>>=20 >>>> OK, thanks. >>>>=20 >>>> =20 >>>>=20 >>>> Tom if that was you - nice job, have been using it for a few years = now :) >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> Kind regards >>>>=20 >>>> =20 >>>>=20 >>>> Stuart Tremain >>>>=20 >>>> Pharoah Lane Software >>>>=20 >>>> AUSTRALIA >>>>=20 >>>> webdna@idfk.com.au >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> On 19 Dec 2017, at 11:15, Michael Davis > wrote: >>>>=20 >>>> =20 >>>>=20 >>>> Stuart, >>>>=20 >>>> =20 >>>>=20 >>>> I think that was Tom. He had worked one up prior to JSONStore. >>>>=20 >>>> =20 >>>>=20 >>>> Mike >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> On Dec 18, 2017, at 3:32 PM, Stuart Tremain > wrote: >>>>=20 >>>> =20 >>>>=20 >>>> Michael >>>>=20 >>>> =20 >>>>=20 >>>> Were you the person that did the JSON parser some time ago ? >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> Kind regards >>>>=20 >>>> =20 >>>>=20 >>>> Stuart Tremain >>>>=20 >>>> Pharoah Lane Software >>>>=20 >>>> AUSTRALIA >>>>=20 >>>> webdna@idfk.com.au >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> On 19 Dec 2017, at 10:22, Michael Davis > wrote: >>>>=20 >>>> =20 >>>>=20 >>>> Yariv, >>>>=20 >>>> =20 >>>>=20 >>>> Here's a starting point for you... >>>>=20 >>>> =20 >>>>=20 >>>> Had to use [middle] to get rid of some garbage, which was strange. = Other than that, it should be pretty straight forward. >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> --------------------------------------------------------- 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 >>>>=20 >>>> =20 >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> On Dec 17, 2017, at 3:54 AM, Office > wrote: >>>>=20 >>>> =20 >>>>=20 >>>> For the last 20 years i never had to receive data from elsewhere = till today. >>>>=20 >>>> I need to ask an API for the bitcoin rate >>>>=20 >>>> i wanted to use the TCPconnect for this but the sample is dead ? : >>>>=20 >>>> =20 >>>>=20 >>>> http://www.webdna.us/page.dna?numero=3D264 = >>>> =20 >>>>=20 >>>> 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 >>>>=20 >>>> = {"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) >>>>=20 >>>> https://api.coindesk.com/v1/bpi/currentprice.json = >>>> =20 >>>>=20 >>>> Or any other way to get a rate into my page :-) >>>>=20 >>>> =20 >>>>=20 >>>> Yours, >>>>=20 >>>> =20 >>>>=20 >>>> Yariv Nachshon >>>>=20 >>>> http://www.plonter.co.il >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> --------------------------------------------------------- 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 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> --------------------------------------------------------- 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 >>>> =20 >>>>=20 >>>> --------------------------------------------------------- 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 >>>> =20 >>>>=20 >>>> --------------------------------------------------------- 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 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 --Apple-Mail=_2665155C-BB75-4F13-B152-AA3464A99BCF Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi = Michael

The issue = was with the pipes that are delivered in the JSON from PayPal (see = example below) making the JSON invalid.

Filter out the pipes and then I think = that you will have success.


Kind regards

Stuart Tremain
Pharoah Lane Software
AUSTRALIA


{|"scope"=3D"https://uri.paypal.com/services/subscriptions https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card https://uri.paypal.com/services/applications/webhooks = openid https://uri.paypal.com/payments/payouts https://api.paypal.com/v1/vault/credit-card/.*",|"nonce"=3D= "2017-12-20T01:06:04ZQKkA0EqAQJMZ-5WtU__vmXZfOfpp5pyU6RBx6suQSYI",|"access= _token"=3D"A21AAG0Ri46F4YVxWcTUR7WO_rekJ0DbA",|"token_type"=3D"Bearer",|"a= pp_id"=3D"APP-80W284485P519543T",|"expires_in"=3D31902}






On 26 Apr 2019, at 08:35, Michael Davis <admin@network13.net>= wrote:

Stuart,

Does this problem = involve ampersands?

MD

On Dec 19, 2017, at 6:58 PM, = Stuart Tremain <webdna@idfk.com.au> wrote:

There is a little = problem with [JSONstore] when working with PayPal that I found = today.

I have = advised WebDNA, hopefully they will do a fix for it.


Kind = regards

Stuart = Tremain
Pharoah Lane Software
AUSTRALIA






On 20 Dec 2017, at 13:47, Brian Harrington <autoglasswny@gmail.com> wrote:

I put that code on a page... was missing a showif... fixed = that. You have an example of a paste...?

On Tue, = Dec 19, 2017 at 4:48 PM, Stuart Tremain <webdna@idfk.com.au> wrote:
Hey= Tom

Nice function = :)


Kind regards

Stuart Tremain
Pharoah Lane = Software
AUSTRALIA






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.

- = Tom



First 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-json-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][/text][/showif][!]
[/!][showif = [url][params_string][/url]^jsonNode][text]tJsonNode=3D[jsonNode][/text][/showif][!]

###  Store the jsonObject in = a table  ###

[/!][jsonstore = table=3DjsonOject][tJsonObject][/jsonstore][!]

###  Search the table =  ###

[/!][search = table=3DjsonOject&ne[tJsonNode]data=3Dfind_all][founditems][!]

= [/!][text]tReturn=3D[interpret][[tJsonNode]][/interpret][/text][!]

[/!][/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>
<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]



=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 :)

 

 

Kind = regards

 

Stuart= Tremain

Pharoah Lane Software

AUSTRALIA

 

 

 

 



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 ?

 

 

Kind regards

 

Stuart Tremain

Pharoah Lane Software

AUSTRALIA

 

 

 

 



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 ? :

 

 

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":"&#36;","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 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 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 --Apple-Mail=_2665155C-BB75-4F13-B152-AA3464A99BCF-- . Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] TCPconnect and Bitcoin rate (Stuart Tremain 2019)
  2. Re: [WebDNA] TCPconnect and Bitcoin rate (Michael Davis 2019)
  3. Re: [WebDNA] TCPconnect and Bitcoin rate (Stuart Tremain 2017)
  4. Re: [WebDNA] TCPconnect and Bitcoin rate (Brian Harrington 2017)
  5. Re: [WebDNA] TCPconnect and Bitcoin rate (Stuart Tremain 2017)
  6. Re: [WebDNA] TCPconnect and Bitcoin rate (Stuart Tremain 2017)
  7. Re: [WebDNA] TCPconnect and Bitcoin rate (Tom Duke 2017)
  8. RE: [WebDNA] TCPconnect and Bitcoin rate ("Terry Nair" 2017)
  9. Re: [WebDNA] TCPconnect and Bitcoin rate (Stuart Tremain 2017)
  10. Re: [WebDNA] TCPconnect and Bitcoin rate (Michael Davis 2017)
  11. Re: [WebDNA] TCPconnect and Bitcoin rate (Stuart Tremain 2017)
  12. Re: [WebDNA] TCPconnect and Bitcoin rate (Michael Davis 2017)
  13. Re: [WebDNA] TCPconnect and Bitcoin rate (Office 2017)
  14. Re: [WebDNA] TCPconnect and Bitcoin rate (Stuart Tremain 2017)
  15. [WebDNA] TCPconnect and Bitcoin rate (Yariv Nachshon 2017)
  16. Re: [WebDNA] TCPconnect and Bitcoin rate (Lawrence Banahan 2017)
  17. [WebDNA] TCPconnect and Bitcoin rate (Office 2017)
2189 --Apple-Mail=_2665155C-BB75-4F13-B152-AA3464A99BCF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Michael The issue was with the pipes that are delivered in the JSON from PayPal = (see example below) making the JSON invalid. Filter out the pipes and then I think that you will have success. Kind regards Stuart Tremain Pharoah Lane Software AUSTRALIA webdna@plsoftware.com.au {|"scope"=3D"https://uri.paypal.com/services/subscriptions = https://api.paypal.com/v1/payments/.* = https://api.paypal.com/v1/vault/credit-card = https://uri.paypal.com/services/applications/webhooks openid = https://uri.paypal.com/payments/payouts = https://api.paypal.com/v1/vault/credit-card/.*",|"nonce"=3D"2017-12-20T01:= 06:04ZQKkA0EqAQJMZ-5WtU__vmXZfOfpp5pyU6RBx6suQSYI",|"access_token"=3D"A21A= AG0Ri46F4YVxWcTUR7WO_rekJ0DbA",|"token_type"=3D"Bearer",|"app_id"=3D"APP-8= 0W284485P519543T",|"expires_in"=3D31902} > On 26 Apr 2019, at 08:35, Michael Davis wrote: >=20 > Stuart, >=20 > Does this problem involve ampersands? >=20 > MD >=20 >> On Dec 19, 2017, at 6:58 PM, Stuart Tremain > wrote: >>=20 >> There is a little problem with [JSONstore] when working with PayPal = that I found today. >>=20 >> I have advised WebDNA, hopefully they will do a fix for it. >>=20 >>=20 >> Kind regards >>=20 >> Stuart Tremain >> Pharoah Lane Software >> AUSTRALIA >> webdna@idfk.com.au >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>> On 20 Dec 2017, at 13:47, Brian Harrington > wrote: >>>=20 >>> I put that code on a page... was missing a showif... fixed that. You = have an example of a paste...? >>>=20 >>> On Tue, Dec 19, 2017 at 4:48 PM, Stuart Tremain > wrote: >>> Hey Tom >>>=20 >>> Nice function :) >>>=20 >>>=20 >>> Kind regards >>>=20 >>> Stuart Tremain >>> Pharoah Lane Software >>> AUSTRALIA >>> webdna@idfk.com.au >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>> On 19 Dec 2017, at 20:23, Tom Duke > wrote: >>>>=20 >>>> Hi all, >>>>=20 >>>> Here is the code I use to deal with JSON. >>>>=20 >>>> - Tom >>>>=20 >>>>=20 >>>>=20 >>>> First a function to pull a value when you know what JSON node you = want: >>>>=20 >>>> [!] >>>>=20 >>>>=20 >>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >>>> FUNCTION Name: smGetJsonValue >>>> ** Description: Pull out a value from a JSONobject >>>> ** Input:=20 >>>> jsonObject =3D (the json to be parsed) - required >>>> jsonNode =3D (the node that we the value of) - required >>>> ** usage:=20 >>>> [smGetJsonValue = jsonObject=3D[url][/url]&jsonNode=3D] >>>>=20 >>>> [/!][function name=3DsmGetJsonValue][!] >>>> [/!][text]tReturn=3D[/text][!] >>>>=20 >>>> [/!][text]tJsonObject=3D[/text][!] >>>> [/!][text]tJsonNode=3Dnull[/text][!] >>>>=20 >>>> [/!][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][!] >>>>=20 >>>> ### Store the jsonObject in a table ### >>>>=20 >>>> [/!][jsonstore table=3DjsonOject][tJsonObject][/jsonstore][!] >>>>=20 >>>> ### Search the table ### >>>>=20 >>>> [/!][search = table=3DjsonOject&ne[tJsonNode]data=3Dfind_all][founditems][!] >>>>=20 >>>> [/!][text]tReturn=3D[interpret][[tJsonNode]][/interpret][/text][!]= >>>>=20 >>>> [/!][/founditems][/search][!] >>>>=20 >>>> ### Return the value ### >>>>=20 >>>> [/!][return][tReturn][/return][!] >>>> [/!][/function] >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> Second a Json parser, that's a bit of a hack: >>>>=20 >>>> [text]debug=3DF[/text] >>>>=20 >>>>

Paste some JSON

>>>>

(some samples here ">http://www.jquery4u= ..com/json/10-example-json-files/ = )

>>>>
[thisurl]" method=3D"post"> >>>> >>>>
>>>> >>>>
>>>>=20 >>>>=20 >>>> [showif [action]=3Dparse-json] >>>>=20 >>>>

Sample JSON

>>>>
[text show=3DT]theJson=3D[sample-json][/text]


>>>>=20 >>>>=20 >>>> [!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### Conversion table to strip non-breaking spaces ### >>>>=20 >>>> [/!][table name=3DjsonClean&fields=3Dfrom,to] >>>> %C2=09 >>>> %A0=09 >>>> [/table][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### Conversion table to facilitate spliting into key:value = pairs ### >>>>=20 >>>> [/!][table name=3DjsonSplitConversions&fields=3Dfrom,to] >>>> |~~~~ >>>> \"^^^^ >>>> [/table][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### Convert back after spliting into key:value pairs ### >>>>=20 >>>> [/!][table name=3DjsonSplitConversionsBack&fields=3Dfrom,to] >>>> "=09 >>>> ~~~~| >>>> ^^^^" >>>> [/table][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### pass one - run the conversions ### >>>>=20 >>>> [/!][text]theJson=3D[convertwords = table=3DjsonSplitConversions][convertchars = table=3DjsonClean][theJson][/convertchars][/convertwords][/text][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### pass two - add bar to just before each key:value pair ### >>>>=20 >>>> [/!][text]theJson=3D[grep = search=3D("[^"]*"):&replace=3D|\1=3D][theJson][/grep][/text][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### pass three - list out the key:value pairs and assign them = to text variables ### >>>>=20 >>>> [/!][text]count=3D0[/text][listwords = words=3D[url][theJson][/url]&delimiters=3D|{}][!] >>>>=20 >>>> [/!][text]thisVal=3D[grep search=3D(,$)&replace=3D][getchars = start=3D1&trim=3Dboth][convertwords = table=3DjsonSplitConversionsBack][word][/convertwords][/getchars][/grep][/= text][!] >>>> =09 >>>> [/!][showif [debug]=3DT][index]. [url][thisVal][/url]
[/showif][!] >>>> =09 >>>> [/!][hideif [url][thisVal][/url]=3D][!] >>>> [/!][text]json-[format .2d][text = show=3DT]count=3D[math][count]+1[/math][/text][/format]-[thisVal][/text][!= ] >>>> [/!][/hideif][!] >>>>=20 >>>> [/!][/listwords][!] >>>>=20 >>>>=20 >>>> ------------------------------------ >>>> ### Let's have a look at the variables ### >>>>=20 >>>> [/!]

JSON Assigned to Text Variables

>>>> [listvariables name=3Djson-&exact=3DF][name] =3D [value]
>>>> [/listvariables] >>>>=20 >>>> [/showif] >>>>=20 >>>>=20 >>>>=20 >>>> =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]: > >>>> [w]: > >>>> =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 >>>>=20 >>>> On 19 December 2017 at 08:01, Terry Nair > wrote: >>>> Kindly point out the link where I can find that JSON wonder =E2=80=A6= need 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 >>>>=20 >>>> =20 >>>>=20 >>>> Cheers TDn >>>>=20 >>>> =C2=A0 <> >>>> From: Stuart Tremain [mailto:webdna@idfk.com.au = ]=20 >>>> Sent: Tuesday, December 19, 2017 08:19 AM >>>> To: WebDNA Talk List > >>>> Subject: Re: [WebDNA] TCPconnect and Bitcoin rate >>>>=20 >>>> =20 >>>>=20 >>>> OK, thanks. >>>>=20 >>>> =20 >>>>=20 >>>> Tom if that was you - nice job, have been using it for a few years = now :) >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> Kind regards >>>>=20 >>>> =20 >>>>=20 >>>> Stuart Tremain >>>>=20 >>>> Pharoah Lane Software >>>>=20 >>>> AUSTRALIA >>>>=20 >>>> webdna@idfk.com.au >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> On 19 Dec 2017, at 11:15, Michael Davis > wrote: >>>>=20 >>>> =20 >>>>=20 >>>> Stuart, >>>>=20 >>>> =20 >>>>=20 >>>> I think that was Tom. He had worked one up prior to JSONStore. >>>>=20 >>>> =20 >>>>=20 >>>> Mike >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> On Dec 18, 2017, at 3:32 PM, Stuart Tremain > wrote: >>>>=20 >>>> =20 >>>>=20 >>>> Michael >>>>=20 >>>> =20 >>>>=20 >>>> Were you the person that did the JSON parser some time ago ? >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> Kind regards >>>>=20 >>>> =20 >>>>=20 >>>> Stuart Tremain >>>>=20 >>>> Pharoah Lane Software >>>>=20 >>>> AUSTRALIA >>>>=20 >>>> webdna@idfk.com.au >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> On 19 Dec 2017, at 10:22, Michael Davis > wrote: >>>>=20 >>>> =20 >>>>=20 >>>> Yariv, >>>>=20 >>>> =20 >>>>=20 >>>> Here's a starting point for you... >>>>=20 >>>> =20 >>>>=20 >>>> Had to use [middle] to get rid of some garbage, which was strange. = Other than that, it should be pretty straight forward. >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> --------------------------------------------------------- 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 >>>>=20 >>>> =20 >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> On Dec 17, 2017, at 3:54 AM, Office > wrote: >>>>=20 >>>> =20 >>>>=20 >>>> For the last 20 years i never had to receive data from elsewhere = till today. >>>>=20 >>>> I need to ask an API for the bitcoin rate >>>>=20 >>>> i wanted to use the TCPconnect for this but the sample is dead ? : >>>>=20 >>>> =20 >>>>=20 >>>> http://www.webdna.us/page.dna?numero=3D264 = >>>> =20 >>>>=20 >>>> 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 >>>>=20 >>>> = {"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) >>>>=20 >>>> https://api.coindesk.com/v1/bpi/currentprice.json = >>>> =20 >>>>=20 >>>> Or any other way to get a rate into my page :-) >>>>=20 >>>> =20 >>>>=20 >>>> Yours, >>>>=20 >>>> =20 >>>>=20 >>>> Yariv Nachshon >>>>=20 >>>> http://www.plonter.co.il >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> --------------------------------------------------------- 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 >>>> =20 >>>>=20 >>>> =20 >>>>=20 >>>> --------------------------------------------------------- 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 >>>> =20 >>>>=20 >>>> --------------------------------------------------------- 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 >>>> =20 >>>>=20 >>>> --------------------------------------------------------- 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 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 --Apple-Mail=_2665155C-BB75-4F13-B152-AA3464A99BCF Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi = Michael

The issue = was with the pipes that are delivered in the JSON from PayPal (see = example below) making the JSON invalid.

Filter out the pipes and then I think = that you will have success.


Kind regards

Stuart Tremain
Pharoah Lane Software
AUSTRALIA


{|"scope"=3D"https://uri.paypal.com/services/subscriptions https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card https://uri.paypal.com/services/applications/webhooks = openid https://uri.paypal.com/payments/payouts https://api.paypal.com/v1/vault/credit-card/.*",|"nonce"=3D= "2017-12-20T01:06:04ZQKkA0EqAQJMZ-5WtU__vmXZfOfpp5pyU6RBx6suQSYI",|"access= _token"=3D"A21AAG0Ri46F4YVxWcTUR7WO_rekJ0DbA",|"token_type"=3D"Bearer",|"a= pp_id"=3D"APP-80W284485P519543T",|"expires_in"=3D31902}






On 26 Apr 2019, at 08:35, Michael Davis <admin@network13.net>= wrote:

Stuart,

Does this problem = involve ampersands?

MD

On Dec 19, 2017, at 6:58 PM, = Stuart Tremain <webdna@idfk.com.au> wrote:

There is a little = problem with [JSONstore] when working with PayPal that I found = today.

I have = advised WebDNA, hopefully they will do a fix for it.


Kind = regards

Stuart = Tremain
Pharoah Lane Software
AUSTRALIA






On 20 Dec 2017, at 13:47, Brian Harrington <autoglasswny@gmail.com> wrote:

I put that code on a page... was missing a showif... fixed = that. You have an example of a paste...?

On Tue, = Dec 19, 2017 at 4:48 PM, Stuart Tremain <webdna@idfk.com.au> wrote:
Hey= Tom

Nice function = :)


Kind regards

Stuart Tremain
Pharoah Lane = Software
AUSTRALIA






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.

- = Tom



First 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-json-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][/text][/showif][!]
[/!][showif = [url][params_string][/url]^jsonNode][text]tJsonNode=3D[jsonNode][/text][/showif][!]

###  Store the jsonObject in = a table  ###

[/!][jsonstore = table=3DjsonOject][tJsonObject][/jsonstore][!]

###  Search the table =  ###

[/!][search = table=3DjsonOject&ne[tJsonNode]data=3Dfind_all][founditems][!]

= [/!][text]tReturn=3D[interpret][[tJsonNode]][/interpret][/text][!]

[/!][/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>
<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]



=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 :)

 

 

Kind = regards

 

Stuart= Tremain

Pharoah Lane Software

AUSTRALIA

 

 

 

 



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 ?

 

 

Kind regards

 

Stuart Tremain

Pharoah Lane Software

AUSTRALIA

 

 

 

 



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 ? :

 

 

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":"&#36;","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 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 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 --Apple-Mail=_2665155C-BB75-4F13-B152-AA3464A99BCF-- . Stuart Tremain

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:

search form problem.. (1997) Error Lob.db records error message not name (1997) A little help on e-mail (HELP!!! :-) ) (1998) [OT] friday pics :-) (2005) Problems getting parameters passed into email. (1997) BannerAds example (1998) Help name our technology! (1997) WebCat2b12 - nesting [tags] (1997) Weird Cookie Problem Part 2 (2007) [setcookie] & [redirect] (1998) Public beta 2 for WebCatalog 4.0 is now available. (2000) Loosing Quantity (2000) hiding links (1999) WebCat2 - [format thousands] (1997) Server slowing down. (1997) Is there an easier way? (1998) taxRate and grandTotal calculation is not showing up on my (2000) using showpage and showcart commands (1996) Where is f2? (1997) [WebDNA] WebDNA is not parsing CSS file (2010)