JSON encoder that is compliant with MongoDB Extended JSON