You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
348 B
17 lines
348 B
4 years ago
|
# `toJson()`
|
||
|
|
||
|
The toJson method converts the collection into JSON string:
|
||
|
|
||
|
```js
|
||
|
const collection = collect({
|
||
|
id: 384,
|
||
|
name: 'Rayquaza',
|
||
|
gender: 'NA',
|
||
|
});
|
||
|
|
||
|
const json = collection.toJson();
|
||
|
|
||
|
// {"id": 384, "name": "Rayquaza", "gender": "NA"}
|
||
|
```
|
||
|
|
||
|
[View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/toJson.js)
|