incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damien Katz <dam...@apache.org>
Subject json term changes
Date Wed, 27 Aug 2008 20:17:09 GMT
I've checked in the json_term_changes branch today. Big thanks to  
Chris Anderson (jchris) as this is mostly his work.

The new term format is:

json_string() = binary()
json_number() = integer() | float()
json_array() = [json_term()]
json_object() = { [{json_string(), json_term()}] }
json_term() = json_string() | json_number() | json_array() |
                     json_object()

The main purpose with these changes are:
1. Less memory. The new json terms use binary strings instead of list  
strings, this makes each JSON string is now about 1/8 the size in  
memory.
2. To use the "blessed" term format. Among Erlang principals, this  
format has been decided upon as standard term format for representing  
JSON in Erlang. The means we should benefit from a wider range of  
Erlang Json libraries sharing the same format, and much faster parsing  
as there is now a proposal to create Erlang built-in functions for  
parsing and producing json using this term format.

Everything should continue work identically for clients, there are no  
semantic changes here. However, this does break existing databases at  
the file level, so you'll have to dump, upgrade and recreate your  
existing databases.

These changes individually are mostly minor, but they are numerous and  
touch a lot of the code base. I'd appreciate any time people can spend  
looking at the changes and testing the code. Comments and criticisms  
welcome. Hopefully we can get this merged into trunk quickly.

-Damien

Mime
View raw message