Skip to content

Commit adfee60

Browse files
authored
Merge pull request #21 from nicojs/add-deserialisation-readme
docs(readme): Add message about deserializing
2 parents 457a4c6 + fa9ca1d commit adfee60

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ This option is a signal to `serialize()` that the object being serialized does n
8888
serialize(obj, {isJSON: true});
8989
```
9090

91+
## Deserializing
92+
93+
For some use cases you might also need to deserialize the string. This is explicitely not part of this module. However, you can easily write it yourself:
94+
95+
```js
96+
function deserialize(serializedJavascript){
97+
return eval('(' + serializedJavascript + ')');
98+
}
99+
```
100+
101+
**Note:** Don't forget the parentheses around the serialized javascript, as the opening bracket `{` will be considered to be the start of a body.
102+
91103
## License
92104

93105
This software is free to use under the Yahoo! Inc. BSD license.

0 commit comments

Comments
 (0)