As we don=E2=80=99t= know the email address of the sender anymore it would be nice for us to =know who we are addressing.
The JSONStore tag is a little confusing and what is also not =well documented is that you can store the data in a table eg:
What= I found to be a useful exercise was to write to my specified db and =then open it and read the data to see what is being done with it. =JSONsStore will write the headers in a db
As the data is often stored in an array =you will have to do a bit of manipulation on the found items.
Here is a JSON function =that may be useful to you.
[!]------------------------------------------------------------=----------
FUNCTION Name: WC-JSONvalue
=+ Description: Pull out a value from a JSONobject
=+ Input:
=JSONobject =3D (the json to be parsed) - required
JSONnode =3D (the node that we =want the value of) - required
+ usage: =[WC-JSONvalue =JSONobject=3D[url]<the-json-object>[/url]&JSONnode=3D<the-jso=n-node>]
+Note: This function MUST receive =valid JSONobject, make sure that there are no line breaks before =beginning of JSON, test your JSON validity here:
https://jsonlint.com---------------------------------------------------------------=-------
[/!][function =name=3DWC-JSONvalue][!]
=[/!][text]rRETURN=3D[/text][!]
=[/!][text]rJSONobject=3D[/text][!]
=[/!][text]rJSONnode=3Dnull[/text][!]
=[/!][showif =[url][params_string][/url]^JSONobject][text]rJSONobject=3D[JSONobject][/te=xt][/showif][!]
[/!][showif =[url][params_string][/url]^JSONnode][text]rJSONnode=3D[JSONnode][/text][/s=howif][!]
-------------------- Store =the JSONobject in a table --------------------
=[/!][JSONstore =table=3DJSONdata][rJSONobject][/jsonstore][!]
=-------------------- Search the table = --------------------
=[/!][SEARCH =table=3DJSONdata&ne[rJSONnode]data=3Dfind_all][!]
=[/!][founditems][!]
=[/!][text]rRETURN=3D[interpret][[rJSONnode]][/interpret][/text][!]<=/div>
=[/!][/founditems][!]
=[/!][/SEARCH][!]
=-------------------- Return the value = --------------------
=[/!][return][rRETURN][/return][!]
[/!][/function]
You man need to play around with the =json object to ensure that it is valid json, I found that PayPal json =did not validate.
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
Hi =all,
I=E2=80=99m looking at the docs for =the JSONStore context. It seems that either the context is lacking =functionality or the documentation is. I do not see a way to =access nested levels in the JSON, like can be done with XML using =path=3D0:1:2 for example. Seems like there should be a way to use =dot notation to get at nested data without storing each array in a temp =db, then reparsing each level with JSONStore into another temp db, =etc.
For example: I want to iterate =the data sets in the =E2=80=9Cresults=E2=80=9D array into a database. = I can use JSONStore to populate a table with the fields: page, =total_results, total_pages and results. Then I can search =that table and run JSONStore on the results field using another =database, but this gets a bit complicated when working with some other =data, in which I need to access data that is 3 or 4 arrays deep.
Anyone solved this puzzle in a more efficient =way yet?
{
= "page":1,
= "total_results":21,
= "total_pages":1,
= "results=E2=80=9D:[
= {
= "popular=ity":1.936,"vote_count=E2=80=9D:7
= },
= {
= "popular=ity=E2=80=9D:2.732,"vote_count=E2=80=9D:23
= },
= {
= "popular=ity=E2=80=9D:12.088,"vote_count=E2=80=9D:75
= },
= {
= "popular=ity=E2=80=9D:53.221,"vote_count=E2=80=9D:5
= },
= {
= "popular=ity=E2=80=9D:7.001,"vote_count=E2=80=9D:31
= },
= {
= "popular=ity=E2=80=9D:22.223,"vote_count=E2=80=9D:88
= }
= ]
}
MD---------------------------------------------------------
This message is sent to you because you are subscribed to
the 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
=---------------------------------------------------------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--Apple-Mail=_837AF1E7-98DF-44A8-A8C1-EF0D37392CE6--.
Associated Messages, from the most recent to the oldest:
2719--Apple-Mail=_837AF1E7-98DF-44A8-A8C1-EF0D37392CE6Content-Transfer-Encoding: quoted-printableContent-Type: text/plain;charset=utf-8Hi MDAs we don=E2=80=99t know the email address of the sender anymore it =would be nice for us to know who we are addressing.The JSONStore tag is a little confusing and what is also not well =documented is that you can store the data in a table eg:[JSONstore table=3DTRANSACTION&fields=3Derror:type,error:message][STRIPERESPONSE][/JSONstore]Then search the table:[SEARCH table=3DTRANSACTION&neERROR:TYPEdatarq=3D[BLANK]]
[!][/!]
[founditems][!][/!]
[text]ERROR-TYPE=3D[ERROR:TYPE][/TEXT]
[!][/!]
[text]ERROR-MESSAGE=3D[ERROR:MESSAGE][/TEXT]
[!][/!][/FOUNDITEMS]
[!][/!][/SEARCH]What I found to be a useful exercise was to write to my specified db and =then open it and read the data to see what is being done with it. =JSONsStore will write the headers in a db[JSONstore db=3Dlogs/stripelog.db][STRIPERESPONSE][/JSONstore]As the data is often stored in an array you will have to do a bit of =manipulation on the found items.Here is a JSON function that may be useful to you.=
[!]----------------------------------------------------------------------FUNCTION Name: WC-JSONvalue+ Description: Pull out a value from a JSONobject+ Input:=20 JSONobject =3D (the json to be parsed) - required JSONnode =3D (the node that we want the value of) - required+ usage: [WC-JSONvalue =JSONobject=3D
[url][/url]&JSONnode=3D]+Note: This function MUST receive valid JSONobject, make sure =that there are no line breaks before beginning of JSON, test your JSON =validity here: https://jsonlint.com----------------------------------------------------------------------[/!][function name=3DWC-JSONvalue][!][/!][text]rRETURN=3D[/text][!][/!][text]rJSONobject=3D[/text][!][/!][text]rJSONnode=3Dnull[/text][!][/!][showif =[url][params_string][/url]^JSONobject][text]rJSONobject=3D[JSONobject][/te=xt][/showif][!][/!][showif =[url][params_string][/url]^JSONnode][text]rJSONnode=3D[JSONnode][/text][/s=howif][!]-------------------- Store the JSONobject in a table =--------------------[/!][JSONstore table=3DJSONdata][rJSONobject][/jsonstore][!]-------------------- Search the table --------------------[/!][SEARCH table=3DJSONdata&ne[rJSONnode]data=3Dfind_all][!][/!][founditems][!]=[/!][text]rRETURN=3D[interpret][[rJSONnode]][/interpret][/text][!][/!][/founditems][!][/!][/SEARCH][!]-------------------- Return the value --------------------[/!][return][rRETURN][/return][!][/!][/function]You man need to play around with the json object to ensure that it is =valid json, I found that PayPal json did not validate.Kind regardsStuart TremainPharoah Lane SoftwareAUSTRALIAwebdna@plsoftware.com.au> On 23 Apr 2020, at 06:45, talk@webdna.us wrote:>=20> Hi all,>=20> I=E2=80=99m looking at the docs for the JSONStore context. It seems =that either the context is lacking functionality or the documentation =is. I do not see a way to access nested levels in the JSON, like can be =done with XML using path=3D0:1:2 for example. Seems like there should =be a way to use dot notation to get at nested data without storing each =array in a temp db, then reparsing each level with JSONStore into =another temp db, etc.>=20> For example: I want to iterate the data sets in the =E2=80=9Cresults=E2==80=9D array into a database. I can use JSONStore to populate a table =with the fields: page, total_results, total_pages and results. Then I =can search that table and run JSONStore on the results field using =another database, but this gets a bit complicated when working with some =other data, in which I need to access data that is 3 or 4 arrays deep.>=20> Anyone solved this puzzle in a more efficient way yet?>=20> {> "page":1,> "total_results":21,> "total_pages":1,> "results=E2=80=9D:[> {> "popularity":1.936,"vote_count=E2=80=9D:7> },> {> "popularity=E2=80=9D:2.732,"vote_count=E2=80=9D:23> },> {> "popularity=E2=80=9D:12.088,"vote_count=E2=80=9D:75> },> {> "popularity=E2=80=9D:53.221,"vote_count=E2=80=9D:5> },> {> "popularity=E2=80=9D:7.001,"vote_count=E2=80=9D:31> },> {> "popularity=E2=80=9D:22.223,"vote_count=E2=80=9D:88> }> ]> }>=20>=20>=20>=20> MD---------------------------------------------------------> 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=_837AF1E7-98DF-44A8-A8C1-EF0D37392CE6Content-Transfer-Encoding: quoted-printableContent-Type: text/html;charset=utf-8Hi =MD
As we don=E2=80=99t= know the email address of the sender anymore it would be nice for us to =know who we are addressing.
The JSONStore tag is a little confusing and what is also not =well documented is that you can store the data in a table eg:
[JSONstore =table=3DTRANSACTION&fields=3Derror:type,error:message]
[STRIPERESPONSE]
[/JSONstore]
Then search the table:
[SEARCH =table=3DTRANSACTION&neERROR:TYPEdatarq=3D[BLANK]]
[!]=[/!]
[text]ERROR-TYPE=3D[ERROR:TYPE][/TEXT]
[!] =[/!]
[text]ERROR-MESSAGE=3D[ERROR:MESSAGE][/TEXT]
[!] [/!][/SEARCH]
What= I found to be a useful exercise was to write to my specified db and =then open it and read the data to see what is being done with it. =JSONsStore will write the headers in a db
[JSONstore =db=3Dlogs/stripelog.db]
[STRIPERESPONSE]
[/JSONstore]
As the data is often stored in an array =you will have to do a bit of manipulation on the found items.
Here is a JSON function =that may be useful to you.
[!]------------------------------------------------------------=----------
FUNCTION Name: WC-JSONvalue
=+ Description: Pull out a value from a JSONobject
=+ Input:
=JSONobject =3D (the json to be parsed) - required
JSONnode =3D (the node that we =want the value of) - required
+ usage: =[WC-JSONvalue =JSONobject=3D
[url]<the-json-object>[/url]&JSONnode=3D<the-jso=n-node>]
+Note: This function MUST receive =valid JSONobject, make sure that there are no line breaks before =beginning of JSON, test your JSON validity here:
https://jsonlint.com---------------------------------------------------------------=-------
[/!][function =name=3DWC-JSONvalue]
[!]=[/!][showif =
[url][params_string][/url]^JSONobject]
[text]rJSONobject=3D[JSONobject][/te=xt][/showif]
[!] [/!][showif =
[url][params_string][/url]^JSONnode]
[text]rJSONnode=3D[JSONnode][/text][/s=howif]
[!]-------------------- Store =the JSONobject in a table --------------------
=[/!][JSONstore =table=3DJSONdata][rJSONobject][/jsonstore]
[!] =-------------------- Search the table = --------------------
=[/!][SEARCH =table=3DJSONdata&ne[rJSONnode]data=3Dfind_all]
[!] =[/!]
[text]rRETURN=3D
[interpret][[rJSONnode]][/interpret][/text]
[!]<=/div>
=-------------------- Return the value = --------------------
[/!][/function]
You man need to play around with the =json object to ensure that it is valid json, I found that PayPal json =did not validate.
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
Hi =all,
I=E2=80=99m looking at the docs for =the JSONStore context. It seems that either the context is lacking =functionality or the documentation is. I do not see a way to =access nested levels in the JSON, like can be done with XML using =path=3D0:1:2 for example. Seems like there should be a way to use =dot notation to get at nested data without storing each array in a temp =db, then reparsing each level with JSONStore into another temp db, =etc.
For example: I want to iterate =the data sets in the =E2=80=9Cresults=E2=80=9D array into a database. = I can use JSONStore to populate a table with the fields: page, =total_results, total_pages and results. Then I can search =that table and run JSONStore on the results field using another =database, but this gets a bit complicated when working with some other =data, in which I need to access data that is 3 or 4 arrays deep.
Anyone solved this puzzle in a more efficient =way yet?
{
= "page":1,
= "total_results":21,
= "total_pages":1,
= "results=E2=80=9D:[
= {
= "popular=ity":1.936,"vote_count=E2=80=9D:7
= },
= {
= "popular=ity=E2=80=9D:2.732,"vote_count=E2=80=9D:23
= },
= {
= "popular=ity=E2=80=9D:12.088,"vote_count=E2=80=9D:75
= },
= {
= "popular=ity=E2=80=9D:53.221,"vote_count=E2=80=9D:5
= },
= {
= "popular=ity=E2=80=9D:7.001,"vote_count=E2=80=9D:31
= },
= {
= "popular=ity=E2=80=9D:22.223,"vote_count=E2=80=9D:88
= }
= ]
}
MD---------------------------------------------------------
This message is sent to you because you are subscribed to
the 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
=---------------------------------------------------------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--Apple-Mail=_837AF1E7-98DF-44A8-A8C1-EF0D37392CE6--.
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:
[Case] on OS X (2000)
$append (1998)
[OT] (waaaay OT) (2004)
What's New Date (2002)
Authenticate Checker - different versions ?? (1998)
Options for http uploading of files (1999)
FTP FOLDER PERMISSIONS (2004)
Date and Time Math (1997)
[cart] Taxrate - seriously .. (2002)
Removing items from a cart is wonky... (1998)
Not really WebCat (1997)
Search (1997)
duplicate cart numbers (2002)
Download Question (1997)
3RD POST Character limit in [Search]? (1998)
using showpage and showcart commands (1996)
WebCat/PDF Integration Time Est (2000)
Fun with dates (1997)
Help! WebCat2 bug (1997)
Summing fields (1997)