Fixes #957: Json::encode() doesn't handle empty object correctly.