add initial JSON serialization

First pass at adding JSON serialization support.