+## toJSON and from JSON
+
+If you'd like to implicitly survive JSON serialization, these two helpers helps:
+
+```js
+import {toJSON, fromJSON} from 'flatted';
+
+class RecursiveMap extends Map {
+ static fromJSON(any) {
+ return new this(fromJSON(any));
+ }
+ toJSON() {
+ return toJSON([...this.entries()]);
+ }
+}
+
+const recursive = new RecursiveMap;
+const same = {};
+same.same = same;
+recursive.set('same', same);
+
+const asString = JSON.stringify(recursive);
+const asMap = RecursiveMap.fromJSON(JSON.parse(asString));
+asMap.get('same') === asMap.get('same').same;
+// true
+```
+
+