New to mongodb and this is more a convention question. I have a python server on the backend that retrieves documents from mongodb and serves as REST API. The API returns data after serializing it using the bson.json_util library.
return bson.json_util.dumps(response, default=default)
This serialized json has an extra layer for certain data types, such as $oid for unique ids, $date for dates and so on. My question is whether there is a javascript deserializer that takes the json and converts it into an object ? Otherwise the data needs to be accessed with an extra layer (start_time.$date). Or is the convention to strip this layer in the API implementation ?
Sample data after being serialized.
{
"name": "test_name_0",
"start_time": {
"$date": 1493650775227
},
"_id": {
"$oid": "59074d577653512111045b3f"
},
"suite_id": {
"$oid": "59074d577653512111045b3e"
}
}