Nmap Development mailing list archives

Re: json library


From: Toni Ruottu <toni.ruottu () iki fi>
Date: Wed, 29 Jun 2011 18:00:26 +0300

"{}" is probably needed as well. I've been looking at ways we could
escape the normal behaviour. Lua has byte strings while json has
unicode strings. One option might be using a Lua-object with an
invalid utf-8 string to signal, that we want that object to be treated
in some specific manner. I am not sure, if this is the best way,
though. :-/

On Wed, Jun 29, 2011 at 5:01 PM, Gorjan Petrovski <mogi57 () gmail com> wrote:
I've looked into the json library and found that if it encounters a
NULL object, then it just returns string with a value "null", so that
would make the "{}" representation redundant.
Well JSON-wise, is there such a thing as a string representing a
nameless empty object when there is a definition for nil?
Has anyone ever encountered the use of "{}"?
If the answer to either of these questions is no, then we can make the
json library default to "[]" when it sees an empty table.

On the other hand if the "{}" is used more than "[]",  a hack has to
be used, and we should probably note this case in the NSEDoc.

Cheers,
Gorjan

On Wed, Jun 29, 2011 at 12:41 AM, Toni Ruottu <toni.ruottu () iki fi> wrote:
I am trying to use the json library to interact with a server that
uses json-rpc. The server expects me ot pass an empty argument list,
i.e. "[]". My problem is that json.generate({}) results in "{}", and
the server gives me an error for sending an object instead of an
array. Is this something we should fix in the json library, or should
I just come up with some kind of a hack?

 --Toni
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/




--
Gorjan

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: