I don't use this package directly, but it helped me a lot when I was building my own import export tool. I recently started adding update timestamps into my firestore data using the FieldValue.serverTimestamp() sentinel. The problem is, when I exported the data and reimported it, the field was no longer a Timestamp object, but rather some unusable json junk... I was able to fix this using some pretty basic replacer/reviver functions in my JSON.parse and JSON.stringify calls:
Then you just need to add the second argument to your stringify and parse calls:
// during export
... JSON.stringify(data, replacer) ...
// during import
... JSON.parse(data, reviver) ...
It wouldn't fix timestamps previously exported, but you could always adjust the reviver to account for objects that look like {"_seconds":1223456,"_nanoseconds":38575} -- that seems to be how the default stringify call was serializing the objects.
I don't use this package directly, but it helped me a lot when I was building my own import export tool. I recently started adding update timestamps into my firestore data using the FieldValue.serverTimestamp() sentinel. The problem is, when I exported the data and reimported it, the field was no longer a Timestamp object, but rather some unusable json junk... I was able to fix this using some pretty basic replacer/reviver functions in my JSON.parse and JSON.stringify calls:
Then you just need to add the second argument to your stringify and parse calls:
It wouldn't fix timestamps previously exported, but you could always adjust the reviver to account for objects that look like
{"_seconds":1223456,"_nanoseconds":38575}
-- that seems to be how the default stringify call was serializing the objects.