Another possibility, if your function has access to the script engine, might be to use its
Good luck!
JSON
object:publicvoid myUpdate(string collectionName, DynamicObject entity) { var json = Convert.ToString(engine.Script.JSON.stringify(entity)); // ... }