Re: [WebDNA] JSONStore Levels

This WebDNA talk-list message is from

2020


It keeps the original formatting.
numero = 115092
interpreted = N
texte = 2721 --Apple-Mail-9E2147B2-7762-4AF9-9D4F-56C9E1F5C33E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Mike Tom Duke wrote an excellent json tool some time ago that may help you.=20 I will dig it out and post it for you.=20 Regards Stuart Tremain Pharoah Lane Software Suite 16, 20 Burlington Street Crows Nest NSW 2065 AUSTRALIA +612 8971 4431 > On 1 May 2020, at 8:18 am, talk@webdna.us wrote: >=20 > =EF=BB=BFHi Stuart, >=20 > I appreciate your answer and have a similar kludge (creative solution) for= my application. I was actually hoping to hear from Chris on this, in hopes= that the underlying JSON parser he is using can be passed dot notation in a= similar way that Javascript uses to parse JSON objects. >=20 > Chris, are there any parameters we can send that are not in the documentat= ion? >=20 >=20 >=20 > Thanks, > Mike Davis >=20 >> On Apr 22, 2020, at 5:05 PM, talk@webdna.us wrote: >>=20 >> Hi MD >>=20 >> 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. >>=20 >> The JSONStore tag is a little confusing and what is also not well documen= ted is that you can store the data in a table eg: >>=20 >>=20 >> [JSONstore table=3DTRANSACTION&fields=3Derror:type,error:message] >> [STRIPERESPONSE] >> [/JSONstore] >>=20 >> Then search the table: >>=20 >> [SEARCH table=3DTRANSACTION&neERROR:TYPEdatarq=3D[BLANK]][!] >> [/!][FOUNDITEMS][!] >> [/!][TEXT]ERROR-TYPE=3D[ERROR:TYPE][/TEXT][!] >> [/!][TEXT]ERROR-MESSAGE=3D[ERROR:MESSAGE][/TEXT][!] >> [/!][/FOUNDITEMS][!] >> [/!][/SEARCH] >>=20 >>=20 >> What I found to be a useful exercise was to write to my specified db and t= hen open it and read the data to see what is being done with it. JSONsStore w= ill write the headers in a db >>=20 >> [JSONstore db=3Dlogs/stripelog.db] >> [STRIPERESPONSE] >> [/JSONstore] >>=20 >> As the data is often stored in an array you will have to do a bit of mani= pulation on the found items. >>=20 >> Here is a JSON function that may be useful to you. >>=20 >>=20 >> [!]----------------------------------------------------------------------= >> 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]&JS= ONnode=3D] >> +Note: This function MUST receive valid JSONobject, make sure that t= here are no line breaks before beginning of JSON, test your JSON validity he= re: 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][/text][/showif][!] >> [/!][showif [url][params_string][/url]^JSONnode][text]rJSONnode=3D[= JSONnode][/text][/showif][!] >> -------------------- 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]][/inter= pret][/text][!] >> [/!][/founditems][!] >> [/!][/SEARCH][!] >> -------------------- Return the value -------------------- >> [/!][return][rRETURN][/return][!] >> [/!][/function] >>=20 >> You man need to play around with the json object to ensure that it is val= id json, I found that PayPal json did not validate. >>=20 >>=20 >>=20 >>=20 >> Kind regards >>=20 >> Stuart Tremain >> Pharoah Lane Software >> AUSTRALIA >> webdna@plsoftware.com.au >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>> 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 tha= t 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 XM= L using path=3D0:1:2 for example. Seems like there should be a way to use d= ot notation to get at nested data without storing each array in a temp db, t= hen 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 t= he fields: page, total_results, total_pages and results. Then I can search= that table and run JSONStore on the results field using another database, b= ut 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 >>=20 >> --------------------------------------------------------- This message is= sent to you because you are subscribed to the mailing list talk@webdna.us T= o unsubscribe, E-mail to: talk-leave@webdna.us archives: http://www.webdna.u= s/page.dna?numero=3D55 Bug Reporting: support@webdna.us >=20 > --------------------------------------------------------- This message is s= ent to you because you are subscribed to the mailing list talk@webdna.us To u= nsubscribe, E-mail to: talk-leave@webdna.us archives: http://www.webdna.us/p= age.dna?numero=3D55 Bug Reporting: support@webdna.us --Apple-Mail-9E2147B2-7762-4AF9-9D4F-56C9E1F5C33E Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Mike

Tom Duke wrote a= n excellent json tool some time ago that may help you. 

<= /div>
I will dig it out and post it for you. 

Regar= ds
Stuart Tremain

Pharoah Lane Software
Suite 16, 20 Burlington Street
Crows= Nest NSW 2065
AUSTRALIA
+612 8971 4431

On 1 May 2020, at 8:18 am, talk@webdna.us w= rote:

=EF= =BB=BFHi Stuart,

I apprecia= te your answer and have a similar kludge (creative solution) for my applicat= ion.  I was actually hoping to hear from Chris on this, in hopes that t= he underlying JSON parser he is using can be passed dot notation in a simila= r way that Javascript uses to parse JSON objects.

Chris, are there any parameters we can send t= hat are not in the documentation?

=


Thanks,
Mike Davis
On Apr 22, 2= 020, at 5:05 PM, talk@webdna.us= wrote:

Hi MD

<= div class=3D"">As we don=E2=80=99t know the email address of the sender anym= ore it would be nice for us to know who we are addressing.

The JSONStore tag is a little confus= ing 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][!]
<= span class=3D"Apple-tab-span" style=3D"white-space:pre">[/!][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 th= en open it and read the data to see what is being done with it. JSONsStore w= ill write the headers in a db

[JSONstore d= b=3Dlogs/stripelog.db]
[STRIPERESPONSE]
[/JSONstore]

As the data is often stored in an array you will have to do a bit of mani= pulation 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
<= span class=3D"Apple-tab-span" style=3D"white-space:pre">+ In= put: 
        JSONobject =3D (= the json to be parsed) - required
      &= nbsp; JSONnode =3D (the node that we want the value of) - required
+ usage: [WC-JSONvalue JSONobject=3D[url]<the-json-object>[/url]&a= mp;JSONnode=3D<the-json-node>]
+Note: This function MUST re= ceive valid JSONobject, make sure that there are no line breaks before begin= ning of JSON, test your JSON validity here: https://jsonlint.com
-----------------= -----------------------------------------------------
[= /!][function name=3DWC-JSONvalue][!]
[/!][text]rRETURN=3D[/text][= !]
[/!][text]rJSONobject=3D[/text][!]
[/!][text]rJ= SONnode=3Dnull[/text][!]
[/!][showif [url][params_string][/ur= l]^JSONobject][text]rJSONobject=3D[JSONobject][/text][/showif][!]
[/!][showif [url][params_string][/url]^JSONnode][text]rJSONnode=3D[JSONn= ode][/text][/showif][!]
--------------------  Store the= JSONobject in a table  --------------------
[/!][JSONsto= re 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 a= round with the json object to ensure that it is valid json, I found that Pay= Pal json did not validate.




Kind regards

Stuart Tremain
<= div class=3D"">Pharoah Lane Software
AUSTRALIA
webdna@p= lsoftware.com.au







On 23 Apr 2020, at 06:45, talk@webdna.us wrote:

Hi all,

I=E2=80=99= m looking at the docs for the JSONStore context.  It seems that either t= he context is lacking functionality or the documentation is.  I do not s= ee a way to access nested levels in the JSON, like can be done with XML usin= g path=3D0:1:2 for example.  Seems like there should be a way to use do= t notation to get at nested data without storing each array in a temp db, th= en 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 p= opulate a table with the fields: page, total_results, total_pages and result= s.   Then I can search that table and run JSONStore on the results= field using another database, but this gets a bit complicated when working w= ith some other data, in which I need to access data that is 3 or 4 arrays de= ep.

Anyone solved this puzzle in a more efficie= nt way yet?

{
   = "page":1,
   "total_results":21,
   "total_pages":1,
   "resul= ts=E2=80=9D:[
       {
           = ;"popularity":1.936,"vote_count=E2=80=9D:7
   =     },
     &nbs= p; {
        &nb= sp;  "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
    &nb= sp;  },
       {=
          =  "popularity=E2=80=9D:7.001,"vote_count=E2=80=9D:31
&nbs= p;      },
   &n= bsp;   {
      &= nbsp;    "popularity=E2=80=9D:22.223,"vote_count=E2=80=9D= :88
       }
   ]
}




MD--------------------------------------= -------------------
This message is sent to you because you ar= e subscribed to
the mailing list talk@webdna.us
To unsubscribe, E-mail to: <= a href=3D"mailto:talk-leave@webdna.us" class=3D"">talk-leave@webdna.usarchives: http://www.webdna.us/page.dna?numero=3D55
Bug R= eporting: support@webdna.us<= /a>

= --------------------------------------------------------- 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: h= ttp://www.webdna.us/page.dna?numero=3D55 Bug Reporting: support@webdn= a.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-9E2147B2-7762-4AF9-9D4F-56C9E1F5C33E-- . Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] JSONStore Levels (Stuart Tremain 2020)
  2. Re: [WebDNA] JSONStore Levels (Tom Duke 2020)
  3. Re: [WebDNA] JSONStore Levels (christophe.billiottet@webdna.us 2020)
  4. Re: [WebDNA] JSONStore Levels (Tom Duke 2020)
  5. Re: [WebDNA] JSONStore Levels (christophe.billiottet@webdna.us 2020)
  6. Re: [WebDNA] JSONStore Levels (christophe.billiottet@webdna.us 2020)
  7. Re: [WebDNA] JSONStore Levels (Michael Davis 2020)
  8. Re: [WebDNA] JSONStore Levels (Tom Duke 2020)
  9. Re: [WebDNA] JSONStore Levels (Michael Davis 2020)
  10. Re: [WebDNA] JSONStore Levels (Tom Duke 2020)
  11. Re: [WebDNA] JSONStore Levels (Stuart Tremain 2020)
  12. Re: [WebDNA] JSONStore Levels (christophe.billiottet@webdna.us 2020)
  13. RE: [WebDNA] JSONStore Levels ("Scott @ Itsula" 2020)
  14. Re: [WebDNA] JSONStore Levels (Stuart Tremain 2020)
  15. Re: [WebDNA] JSONStore Levels (Michael Davis 2020)
  16. Re: [WebDNA] JSONStore Levels (Stuart Tremain 2020)
  17. Re: [WebDNA] JSONStore Levels (Stuart Tremain 2020)
  18. Re: [WebDNA] JSONStore Levels (Michael Davis 2020)
  19. Re: [WebDNA] JSONStore Levels (Stuart Tremain 2020)
  20. [WebDNA] JSONStore Levels (Michael Davis 2020)
2721 --Apple-Mail-9E2147B2-7762-4AF9-9D4F-56C9E1F5C33E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Mike Tom Duke wrote an excellent json tool some time ago that may help you.=20 I will dig it out and post it for you.=20 Regards Stuart Tremain Pharoah Lane Software Suite 16, 20 Burlington Street Crows Nest NSW 2065 AUSTRALIA +612 8971 4431 > On 1 May 2020, at 8:18 am, talk@webdna.us wrote: >=20 > =EF=BB=BFHi Stuart, >=20 > I appreciate your answer and have a similar kludge (creative solution) for= my application. I was actually hoping to hear from Chris on this, in hopes= that the underlying JSON parser he is using can be passed dot notation in a= similar way that Javascript uses to parse JSON objects. >=20 > Chris, are there any parameters we can send that are not in the documentat= ion? >=20 >=20 >=20 > Thanks, > Mike Davis >=20 >> On Apr 22, 2020, at 5:05 PM, talk@webdna.us wrote: >>=20 >> Hi MD >>=20 >> 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. >>=20 >> The JSONStore tag is a little confusing and what is also not well documen= ted is that you can store the data in a table eg: >>=20 >>=20 >> [JSONstore table=3DTRANSACTION&fields=3Derror:type,error:message] >> [STRIPERESPONSE] >> [/JSONstore] >>=20 >> Then search the table: >>=20 >> [SEARCH table=3DTRANSACTION&neERROR:TYPEdatarq=3D[BLANK]][!] >> [/!][founditems][!] >> [/!][text]ERROR-TYPE=3D[ERROR:TYPE][/TEXT][!] >> [/!][text]ERROR-MESSAGE=3D[ERROR:MESSAGE][/TEXT][!] >> [/!][/FOUNDITEMS][!] >> [/!][/SEARCH] >>=20 >>=20 >> What I found to be a useful exercise was to write to my specified db and t= hen open it and read the data to see what is being done with it. JSONsStore w= ill write the headers in a db >>=20 >> [JSONstore db=3Dlogs/stripelog.db] >> [STRIPERESPONSE] >> [/JSONstore] >>=20 >> As the data is often stored in an array you will have to do a bit of mani= pulation on the found items. >>=20 >> Here is a JSON function that may be useful to you. >>=20 >>=20 >> [!]----------------------------------------------------------------------= >> 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]&JS= ONnode=3D] >> +Note: This function MUST receive valid JSONobject, make sure that t= here are no line breaks before beginning of JSON, test your JSON validity he= re: 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][/text][/showif][!] >> [/!][showif [url][params_string][/url]^JSONnode][text]rJSONnode=3D[= JSONnode][/text][/showif][!] >> -------------------- 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]][/inter= pret][/text][!] >> [/!][/founditems][!] >> [/!][/SEARCH][!] >> -------------------- Return the value -------------------- >> [/!][return][rRETURN][/return][!] >> [/!][/function] >>=20 >> You man need to play around with the json object to ensure that it is val= id json, I found that PayPal json did not validate. >>=20 >>=20 >>=20 >>=20 >> Kind regards >>=20 >> Stuart Tremain >> Pharoah Lane Software >> AUSTRALIA >> webdna@plsoftware.com.au >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>> 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 tha= t 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 XM= L using path=3D0:1:2 for example. Seems like there should be a way to use d= ot notation to get at nested data without storing each array in a temp db, t= hen 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 t= he fields: page, total_results, total_pages and results. Then I can search= that table and run JSONStore on the results field using another database, b= ut 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 >>=20 >> --------------------------------------------------------- This message is= sent to you because you are subscribed to the mailing list talk@webdna.us T= o unsubscribe, E-mail to: talk-leave@webdna.us archives: http://www.webdna.u= s/page.dna?numero=3D55 Bug Reporting: support@webdna.us >=20 > --------------------------------------------------------- This message is s= ent to you because you are subscribed to the mailing list talk@webdna.us To u= nsubscribe, E-mail to: talk-leave@webdna.us archives: http://www.webdna.us/p= age.dna?numero=3D55 Bug Reporting: support@webdna.us --Apple-Mail-9E2147B2-7762-4AF9-9D4F-56C9E1F5C33E Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Mike

Tom Duke wrote a= n excellent json tool some time ago that may help you. 

<= /div>
I will dig it out and post it for you. 

Regar= ds
Stuart Tremain

Pharoah Lane Software
Suite 16, 20 Burlington Street
Crows= Nest NSW 2065
AUSTRALIA
+612 8971 4431

On 1 May 2020, at 8:18 am, talk@webdna.us w= rote:

=EF= =BB=BFHi Stuart,

I apprecia= te your answer and have a similar kludge (creative solution) for my applicat= ion.  I was actually hoping to hear from Chris on this, in hopes that t= he underlying JSON parser he is using can be passed dot notation in a simila= r way that Javascript uses to parse JSON objects.

Chris, are there any parameters we can send t= hat are not in the documentation?

=


Thanks,
Mike Davis
On Apr 22, 2= 020, at 5:05 PM, talk@webdna.us= wrote:

Hi MD

<= div class=3D"">As we don=E2=80=99t know the email address of the sender anym= ore it would be nice for us to know who we are addressing.

The JSONStore tag is a little confus= ing 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][!]
<= span class=3D"Apple-tab-span" style=3D"white-space:pre">[/!][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 th= en open it and read the data to see what is being done with it. JSONsStore w= ill write the headers in a db

[JSONstore d= b=3Dlogs/stripelog.db]
[STRIPERESPONSE]
[/JSONstore]

As the data is often stored in an array you will have to do a bit of mani= pulation 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
<= span class=3D"Apple-tab-span" style=3D"white-space:pre">+ In= put: 
        JSONobject =3D (= the json to be parsed) - required
      &= nbsp; JSONnode =3D (the node that we want the value of) - required
+ usage: [WC-JSONvalue JSONobject=3D[url]<the-json-object>[/url]&a= mp;JSONnode=3D<the-json-node>]
+Note: This function MUST re= ceive valid JSONobject, make sure that there are no line breaks before begin= ning of JSON, test your JSON validity here: https://jsonlint.com
-----------------= -----------------------------------------------------
[= /!][function name=3DWC-JSONvalue][!]
[/!][text]rRETURN=3D[/text][= !]
[/!][text]rJSONobject=3D[/text][!]
[/!][text]rJ= SONnode=3Dnull[/text][!]
[/!][showif [url][params_string][/ur= l]^JSONobject][text]rJSONobject=3D[JSONobject][/text][/showif][!]
[/!][showif [url][params_string][/url]^JSONnode][text]rJSONnode=3D[JSONn= ode][/text][/showif][!]
--------------------  Store the= JSONobject in a table  --------------------
[/!][JSONsto= re table=3DJSONdata][rJSONobject][/jsonstore][!]
------------= --------  Search the table  --------------------
[/!]= [SEARCH table=3DJSONdata&ne[rJSONnode]data=3Dfind_all][!]
[/!][text]rRETURN=3D= [interpret][[rJSONnode]][/interpret][/text][!]
[/!]= [/founditems][!]
[/!][/SEARCH][!]
------------= --------  Return the value  --------------------
[/!]= [return][rRETURN][/return][!]
[/!][/function]

You man need to play a= round with the json object to ensure that it is valid json, I found that Pay= Pal json did not validate.




Kind regards

Stuart Tremain
<= div class=3D"">Pharoah Lane Software
AUSTRALIA
webdna@p= lsoftware.com.au







On 23 Apr 2020, at 06:45, talk@webdna.us wrote:

Hi all,

I=E2=80=99= m looking at the docs for the JSONStore context.  It seems that either t= he context is lacking functionality or the documentation is.  I do not s= ee a way to access nested levels in the JSON, like can be done with XML usin= g path=3D0:1:2 for example.  Seems like there should be a way to use do= t notation to get at nested data without storing each array in a temp db, th= en 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 p= opulate a table with the fields: page, total_results, total_pages and result= s.   Then I can search that table and run JSONStore on the results= field using another database, but this gets a bit complicated when working w= ith some other data, in which I need to access data that is 3 or 4 arrays de= ep.

Anyone solved this puzzle in a more efficie= nt way yet?

{
   = "page":1,
   "total_results":21,
   "total_pages":1,
   "resul= ts=E2=80=9D:[
       {
           = ;"popularity":1.936,"vote_count=E2=80=9D:7
   =     },
     &nbs= p; {
        &nb= sp;  "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
    &nb= sp;  },
       {=
          =  "popularity=E2=80=9D:7.001,"vote_count=E2=80=9D:31
&nbs= p;      },
   &n= bsp;   {
      &= nbsp;    "popularity=E2=80=9D:22.223,"vote_count=E2=80=9D= :88
       }
   ]
}




MD--------------------------------------= -------------------
This message is sent to you because you ar= e subscribed to
the mailing list talk@webdna.us
To unsubscribe, E-mail to: <= a href=3D"mailto:talk-leave@webdna.us" class=3D"">talk-leave@webdna.usarchives: http://www.webdna.us/page.dna?numero=3D55
Bug R= eporting: support@webdna.us<= /a>

= --------------------------------------------------------- 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: h= ttp://www.webdna.us/page.dna?numero=3D55 Bug Reporting: support@webdn= a.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-9E2147B2-7762-4AF9-9D4F-56C9E1F5C33E-- . 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:

math on date? (1997) [PROTECT] Problem (2003) Message Board (again:-) (2000) [OT] HTML Table Cell Problem (2003) can you take a look (2003) Separate SSL Server (1997) Weird problems with [SHOWIF]s (1997) WebCat2b13MacPlugin - [math][date][/math] problem (1997) WebCat2 several catalogs? (1997) WebObjects (2000) Press Release hit the NewsWire!!! (1997) Fun with Dates - revisited (1997) Re2: Calculating multiple shipping... (1997) Hiding HTML and breaking the page (1997) Re:WebCatalog/WebMerchant III (1998) WebCatalog not running after upgrade (2000) Appendfile memory usage (redux) (2003) PCS Customer submissions ? (1997) [WebDNA] Function "libraries" (2009) flushdatabases (1997)