Nmap Development mailing list archives

Re: json library


From: David Fifield <david () bamsoftware com>
Date: Fri, 1 Jul 2011 09:15:48 -0700

On Wed, Jun 29, 2011 at 04:01:17PM +0200, Gorjan Petrovski 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.

{} and null are not the same. The json.lua library uses

NULL = {}

but that is only so that the NULL object is unique. Two different tables
in Lua are unqeual even if their contents are equal, for example

{} == {}  --> false

This ensures that the only way to get a JavaScript null into a JSON
table is to use json.NULL. The json library originally used the string
"JAVASCRIPT NULL" as the magic value, but that was bad because you cuold
legitimately have that string in data. See this post about json.NULL and
see the rest of the thread for some history.

http://seclists.org/nmap-dev/2010/q1/641

The punning of {} and [] is a bug though.

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


Current thread: