Hi,<br><br>When I post json objects from jquery<br><br>$.ajax({ <br>        type: 'POST', <br>        url: '/url',<br>        dataType: 'json',<br>        data:  {"key":"val","hash",{"foo":"bar"}}<br>
<br>then the "hash" parameter is posted like this: "hash[foo]=bar"<br><br>If I then in hunchentoot have <br><br>(define-easy-handler (fn :uri "/url")<br>    ((hash :parameter-type 'hash-table))<br>
.....<br><br>The hash is expected to be posted like this: "hash{foo}=bar"?<br>So I wonder if it would be correct to enable the "hash[foo]=bar" syntax for hash tables.<br><br>Maybe it should be an argument that specifies if compute-hash-table-parameter should use [] or {}. <br>
This little experiment worked for me, here I just added \\[ and \\] to the regexp.<br><br>Should I bother to make a patch?<br><br>(defun compute-hash-table-parameter (parameter-name type parameters key-type test-function)<br>
  "Retrieves all parameters from PARAMETERS which are named like                                                                                 <br>\"PARAMETER-NAME{FOO}\" or \"PARAMETER-NAME[FOO]\"  \(where FOO is any sequence of characters                                                                                <br>
not containing curly brackets), converts them to TYPE, and                                                                                       <br>returns a hash table with test function TEST-FUNCTION where the                                                                                  <br>
corresponding value is associated with the key FOO \(converted to                                                                                <br>KEY-TYPE)."<br>  (let ((hash-table (make-hash-table :test test-function)))<br>
    (loop for (full-name . value) in parameters<br>          for key = (register-groups-bind (name key-string)<br>                        ("^(.*)[{\\[]([^\\[\\]{}]+)[}\\]]$" full-name)<br>                      (when (string= name parameter-name)<br>
                        (convert-parameter key-string key-type)))<br>          when key<br>          do (setf (gethash key hash-table)<br>                   (convert-parameter value type)))<br>    hash-table))<br><br><br>
-- <br>Knut Olav Bøhmer<br>