Hi Alex,

> this is really funny. Just of today I'm working on a similar problem. As
> I don't know JSON, however, I tried a direct approach with JS. The
> mechanism looks surprisingly similar to what you wrote.

JSON is just a data format that is closer to JavaScript than is XML. {x:
11, y: 22, z: 33} is an example of an object with properties x, y and z.
An array could look like ["a", 2, {k: 5}].

> You can also encode numbers, internal+external symbols, and simple
> lists, if you use 'ht:Fmt' (or 'mkUrl').
>    : (pack "http://localhost:8080/@json?"; (ht:Fmt 123 'abc (4 5 6)))
>    -> "http://localhost:8080/@json?+123&$abc&_+4_+5_+6";

That's nice, but more useful when the request shall come from Pico Lisp.
In my case, requests are coming from JavaScript in the browser. ;-)

It seems to me that it won't be easy to make use of the Pico Lisp URL
encoding system when using jQuery AJAX calls like getJSON, as jQuery uses
the more traditional key-value style (http://...?k1=v1&k2=v2...). Is there
any chance that you could add a feature to the server in lib/http.l for
this? Maybe an extra parameter to (server 8080 "@foo" ...) could indicate
that incoming URLs should be interpreted in a key-value style, and the
keys and values be given as a property list, as input to the 'foo'
function ...

What do you think?


Reply via email to