Hi Tom! I suppose you could try something like this: first, c=reate the table, something like this should work fine
[JSONstore table=3DtabJSONPARSE]
JSONobject
[/JSONstore]
you do not need to know the exact structure of the incoming JSON response, =WebDNA will do it for you (I have personally not tested with a table, but i=t does with a db)
Then, you can use [convertwords]:
[convertwords table=3DtabJSONPARSE]error:type and error:message[/convertwor=ds]
This should work=E2=80=A6
- chris
> On Mar 4, 2017, at 16:59, Tom Duke <tom@revolutionaries.ie> wrote:
>
> Chris,
>
> Hi - I'm using [jsonstore] and it's great to have it.=C2=A0 It='s not a flexible as [xmlparse] though.
>
> So if I want to pull out the error message from a Stripe.com json resp=onse I have to do the following:
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[table na=me=3DtabJSONPARSE&fields=3DtID,error:type,error:message][/ tab=le][!]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[/!][jsonstore t=able=3DtabJSONPARSE][varSTRIPERESPONSE][/jsonstore] [!]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[/!][search tabl=e=3DtabJSONPARSE&netIDdatarq=3Dfind_all][ founditems][!]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ==C2=A0 =C2=A0[/!][text]error:type=3D[error:type][/text][!]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ==C2=A0 =C2=A0[/!][text]error:message=3D[error:message][/text][!]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[/!][/founditems=][/search]
>
> Only then can I access the variable [error:message].=C2=A0 I also need= to know the exact structure of the incoming JSON response so I can set up =the table correctly.
>
> If we had similar functionality to [xmlparse] then I could do somethin=g like:
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [jsonparse var==3Djson_var1][varSTRIPERESPONSE][/jsonparse]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [jsonnode ref==3Djson_var1&path=3Dnamed:error:message][value][/ jsonnode]
>
> It would also be great to be able to traverse the JSON response, parti=cularly if we are not sure about the structure of the incoming JSON
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [jsonnodes ref==3Djson_var1]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ==C2=A0 [name]=3D[value]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [/jsonnodes]
>
>
> - Tom
>
>
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<=br>> Digital Revolutionaries
> 1st Floor, Castleriver House
> 14-15 Parliament Street
> Temple Bar,Dublin 2
> Ireland
> ----------------------------------------------
> [t]: + =353 1 4403907
> [e]: <mailto:tom@revoluti=onaries.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<=br>>
> On 3 March 2017 at 15:27, <christophe.billiottet@webdna.us > wrote:
> Hi Tom! WebDNA already includes a JSON parser, that takes any JSON Obj=ect, parse and store it: it will automatically create the database if it do=es not exist, create the fields and populate it.
>
> http://www.webdna.us/page.dna?numero=3D307 >
> From this, it is easy to use the data by treating the database (or tab=le) like any other WebDNA database.
>
> best regards,
>
> - chris
>
>
>
> > On Mar 3, 2017, at 15:57, Tom Duke <tom@revolutionaries.ie> wrote:
> >
> > Chris,
> >
> > Hi - great to hear that you are working on this.
> >
> > The features that I would love to see are:
> >
> >
> > [json_encode]{data}[/json_encode]
> >
> > It would operate the same as the matching PHP function: http://www.php.net/manual/en/function.json-encode=..php
> >
> > So the data would be a WebDNA array and/or perhaps name/value pai=rs separated by line returns. Nested JSON would require some thought, some =ideas here: http://stack=overflow.com/questions/15810257/create- nested-json-object-in-php<=/a>
> >
> >
> > [json_parse]{data}[/json_parse]
> >
> > It would operate in a similar way to [xmlparse] allowing us to tr=averse and extract the JSON data by node.=C2=A0 Also similar to the PHP jso=n_decode function: http://www.php.net/manual/en=/function.json-decode.php
> >
> >
> >
> > - Tom
> >
> >
> >
> >
> >
> >
> >
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=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@rev=olutionaries.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 27 February 2017 at 14:24, <christophe.billiottet@webdna.us > wrote:
> > Hello,
> >
> > we are interested to expand and develop the JSON capabilities and= compatibility of WebDNA, particularly treating JSON-formatted returns from= javascript as well as submitting JSON-formatted info to external programs =and applications.
> >
> > If you have any related ideas, we are listening! :-)
> >
> > - chris-----------------------------------------------------=-- --
> > This message is sent to you because you are subscribed to
> > the mailing list <talk@webdn=a.us>.
> > To unsubscribe, E-mail to: <talk-leave@webdna.us>
> > archives: http://mail.webdna.us/list/talk@we=bdna.us
> > Bug Reporting: support@webdn=a.us
> >
> > --------------------------------------------------------- Th=is message is sent to you because you are subscribed to the mailing list . =To unsubscribe, E-mail to: archives: http://mail.webdna.us/=list/ talk@webdna.us Bug Reporting: support@webdna.us
>
> ---------------------------------------------------------
> This message is sent to you because you are subscribed to
> the mailing list <talk@webdna.us<=/a>>.
> To unsubscribe, E-mail to: <talk-leave@webdna.us>
> archives: http://mail.webdna.us/list/talk@webdna.=us
> Bug Reporting: support@webdna.us<=/a>
>
> --------------------------------------------------------- This me=ssage is sent to you because you are subscribed to the mailing list . To un=subscribe, E-mail to: archives: http://mail.webdna.us/list/= talk@webdna.us Bug Reporting: support@webdna.us
---------------------------------------------------------
This message is sent to you because you are subscribed to
the mailing list <talk@webdna.us&g=t;.
To unsubscribe, E-mail to: <talk=-leave@webdna.us>
archives: http://mail.webdna.us/list/talk@webdna.us
Bug Reporting: support@webdna.us
|
Hi Tom! I suppose you could try something like this: first, c=reate the table, something like this should work fine
[JSONstore table=3DtabJSONPARSE]
JSONobject
[/JSONstore]
you do not need to know the exact structure of the incoming JSON response, =WebDNA will do it for you (I have personally not tested with a table, but i=t does with a db)
Then, you can use [convertwords]:
[convertwords table=3DtabJSONPARSE]error:type and error:message[/convertwor=ds]
This should work=E2=80=A6
- chris
> On Mar 4, 2017, at 16:59, Tom Duke <tom@revolutionaries.ie> wrote:
>
> Chris,
>
> Hi - I'm using [JSONstore] and it's great to have it.=C2=A0 It='s not a flexible as [xmlparse] though.
>
> So if I want to pull out the error message from a Stripe.com json resp=onse I have to do the following:
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[table na=me=3DtabJSONPARSE&fields=3DtID,error:type,error:message][/ tab=le][!]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[/!][jsonstore t=able=3DtabJSONPARSE][varSTRIPERESPONSE][/jsonstore] [!]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[/!][search tabl=e=3DtabJSONPARSE&netIDdatarq=3Dfind_all][ founditems][!]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ==C2=A0 =C2=A0[/!][text]error:type=3D[error:type][/text][!]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ==C2=A0 =C2=A0[/!][text]error:message=3D[error:message][/text][!]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[/!][/founditems=][/search]
>
> Only then can I access the variable [error:message].=C2=A0 I also need= to know the exact structure of the incoming JSON response so I can set up =the table correctly.
>
> If we had similar functionality to [xmlparse] then I could do somethin=g like:
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [jsonparse var==3Djson_var1][varSTRIPERESPONSE][/jsonparse]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [jsonnode ref==3Djson_var1&path=3Dnamed:error:message][value][/ jsonnode]
>
> It would also be great to be able to traverse the JSON response, parti=cularly if we are not sure about the structure of the incoming JSON
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [jsonnodes ref==3Djson_var1]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ==C2=A0 [name]=3D[value]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [/jsonnodes]
>
>
> - Tom
>
>
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<=br>> Digital Revolutionaries
> 1st Floor, Castleriver House
> 14-15 Parliament Street
> Temple Bar,Dublin 2
> Ireland
> ----------------------------------------------
> [t]: + =353 1 4403907
> [e]: <mailto:tom@revoluti=onaries.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<=br>>
> On 3 March 2017 at 15:27, <christophe.billiottet@webdna.us > wrote:
> Hi Tom! WebDNA already includes a JSON parser, that takes any JSON Obj=ect, parse and store it: it will automatically create the database if it do=es not exist, create the fields and populate it.
>
> http://www.webdna.us/page.dna?numero=3D307 >
> From this, it is easy to use the data by treating the database (or tab=le) like any other WebDNA database.
>
> best regards,
>
> - chris
>
>
>
> > On Mar 3, 2017, at 15:57, Tom Duke <tom@revolutionaries.ie> wrote:
> >
> > Chris,
> >
> > Hi - great to hear that you are working on this.
> >
> > The features that I would love to see are:
> >
> >
> > [json_encode]{data}[/json_encode]
> >
> > It would operate the same as the matching PHP function: http://www.php.net/manual/en/function.json-encode=..php
> >
> > So the data would be a WebDNA array and/or perhaps name/value pai=rs separated by line returns. Nested JSON would require some thought, some =ideas here: http://stack=overflow.com/questions/15810257/create- nested-json-object-in-php<=/a>
> >
> >
> > [json_parse]{data}[/json_parse]
> >
> > It would operate in a similar way to [xmlparse] allowing us to tr=averse and extract the JSON data by node.=C2=A0 Also similar to the PHP jso=n_decode function: http://www.php.net/manual/en=/function.json-decode.php
> >
> >
> >
> > - Tom
> >
> >
> >
> >
> >
> >
> >
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=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@rev=olutionaries.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 27 February 2017 at 14:24, <christophe.billiottet@webdna.us > wrote:
> > Hello,
> >
> > we are interested to expand and develop the JSON capabilities and= compatibility of WebDNA, particularly treating JSON-formatted returns from= javascript as well as submitting JSON-formatted info to external programs =and applications.
> >
> > If you have any related ideas, we are listening! :-)
> >
> > - chris-----------------------------------------------------=-- --
> > This message is sent to you because you are subscribed to
> > the mailing list <talk@webdn=a.us>.
> > To unsubscribe, E-mail to: <talk-leave@webdna.us>
> > archives: http://mail.webdna.us/list/talk@we=bdna.us
> > Bug Reporting: support@webdn=a.us
> >
> > --------------------------------------------------------- Th=is message is sent to you because you are subscribed to the mailing list . =To unsubscribe, E-mail to: archives: http://mail.webdna.us/=list/ talk@webdna.us Bug Reporting: support@webdna.us
>
> ---------------------------------------------------------
> This message is sent to you because you are subscribed to
> the mailing list <talk@webdna.us<=/a>>.
> To unsubscribe, E-mail to: <talk-leave@webdna.us>
> archives: http://mail.webdna.us/list/talk@webdna.=us
> Bug Reporting: support@webdna.us<=/a>
>
> --------------------------------------------------------- This me=ssage is sent to you because you are subscribed to the mailing list . To un=subscribe, E-mail to: archives: http://mail.webdna.us/list/= talk@webdna.us Bug Reporting: support@webdna.us
---------------------------------------------------------
This message is sent to you because you are subscribed to
the mailing list <talk@webdna.us&g=t;.
To unsubscribe, E-mail to: <talk=-leave@webdna.us>
archives: http://mail.webdna.us/list/talk@webdna.us
Bug Reporting: support@webdna.us
DOWNLOAD WEBDNA NOW!
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...