Forum OpenACS Development: Re: JSON Array & objects

Collapse
7: Re: JSON Array & objects (response to 6)
Posted by Steve Manning on
I took a slightly different approach, installing rl_json 0.9.7 which avoids the TCL 8.6 Tcl_NREvalObj problem and allows me to use it with TCL8.5. Seems to be working OK so far.

I use

package require rl_json
namespace path {::rl_json}

To get the json commands into the namespace.

Hope that helps.

Steve

Collapse
8: Re: JSON Array & objects (response to 7)
Posted by Iuri Sampaio on
It seems TDOM >= 0.9 does JSON. It parses into a DOM tree, serializes that back to the same JSON (infoset), preserving data type, order of object members, even non unique object members.

Updating TDOM seems to be an easier solution.

I will install both libraries ! rsrs
It will take more time, but it will be a good exercise to recycle skills!

Thanks Steve

Collapse
9: Re: JSON Array & objects (response to 8)
Posted by Iuri Sampaio on
Collapse
10: Re: JSON Array & objects (response to 9)
Posted by Iuri Sampaio on
Steve,

It turns out that tDOM 0.9 also depends on TCL 8.6. Thus, I solved the problem, amending install-ns.sh script to install tdom 0.9, tcl 8.6, and of course NS 4.99.16.

Furthermore, upgrading TCL to 8.6 was an old task that I had postponed from a while ago, because of an issue that not only myself but also Michael Aram had. He's posted here in OACS Forum, regarding [ns_return 200 text/plain ${v}v]

i.e. "Ain’t No ☀shine", https://openacs.org/forums/message-view?message_id=5379887

@Gustaf, rl_json is just beautiful! Thanks for the tip Gustaf!

Best wishes

Collapse
11: Re: JSON Array & objects (response to 10)
Posted by Steve Manning on
I suppose I'm only delaying the inevitable :o)

Yes, rl_json is cool. I especially like the templating, the power of which I didn't appreciate until I started to use it.

Steve

Collapse
12: Re: JSON Array & objects (response to 10)
Posted by Iuri Sampaio on
Gustaf,

As you're the author of most of install-ns.sh script, If you allow me, I can share it on my Github repository.

I also made a few more tweaks to install systemctl on Debian 8 and Ubuntu 14.04(lts)

Best wishes,

Collapse
13: Re: JSON Array & objects (response to 12)
Posted by Gustaf Neumann on
iuri, since a few months, install-ns installs per default Tcl 8.6.8. Can it be that you have downloaded the script a while ago without updating it later?
Collapse
14: Re: JSON Array & objects (response to 13)
Posted by Gustaf Neumann on
tdom 0.9.0 works at least with Tcl 8.5.19 (I've just compiled it iin this combination), i would expect it to be as well compatible with Tcl 8.4 and 8.3.

Although we had recently problems on one site with tdom 0.9, it turned out finally that the same problems were already in tdom 0.8.3. I think, tdom 0.9.0 can be recommended in general. The updated version of install-ns.sh contains by default support for 0.9.0.

Concerning Tcl 8.6: since Tcl 8.6.7 there are no known issues in connection with OpenACS.

Collapse
16: Re: JSON Array & objects (response to 14)
Posted by Iuri Sampaio on
Since I've use tDOM only on XML-RPC, I've decided to try and learn rl_json.

Best wishes,

Collapse
17: Re: JSON Array & objects (response to 16)
Posted by Gustaf Neumann on
OpenACS uses tdom for many tasks via the xml_* interface. Examples are .xql and .info fiiles.
Collapse
18: Re: JSON Array & objects (response to 17)
Posted by Iuri Sampaio on
Yes, I've noticed that!

In fact, that's why I'd rather use it.

JSON's format has become more and more popular, as for website and webservice's integration.
I realized we have very few ad_procs related to JSON. Unfortunately, differently from XML-RPC, JSON is very much encoding dependent, which makes it hard to maintain, even harder to build API standard procs, for community-wide contribution.

Best wishes,

Collapse
15: Re: JSON Array & objects (response to 13)
Posted by Iuri Sampaio on
Yes, it could be.