Skip to content

Commit

Permalink
added section about FLatted VS JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
WebReflection committed Sep 17, 2019
1 parent 12359ea commit 4642cd8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -24,6 +24,15 @@ a.push(a);
stringify(a); // [["1","0"],{"a":"0"}]
```

## Flatted VS JSON

As it is for every other specialized format capable of serializing and deserializing circular data, you should never `JSON.parse(Flatted.stringify(data))`, and you should never `Flatted.parse(JSON.stringify(data))`.

The only way this could work is to `Flatted.parse(Flatted.stringify(data))`, as it is also for _CircularJSON_ or any other, otherwise there's no granted data integrity.

Also please note this project serializes and deserializes only data compatible with JSON, so that sockets, or anything else with internal classes different from those allowed by JSON standard, won't be serialized and unserialized as expected.


### New in V1: Exact same JSON API

* Added a [reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Syntax) parameter to `.parse(string, reviver)` and revive your own objects.
Expand Down

0 comments on commit 4642cd8

Please sign in to comment.