mirror of
https://github.com/cp6/my-idlers.git
synced 2025-04-20 18:18:36 +00:00
17 lines
No EOL
348 B
Markdown
17 lines
No EOL
348 B
Markdown
# `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) |