added JSON encoding of ordered dictionary data structures for writing to mongodb