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.

16 lines
348 B

4 years ago
  1. # `toJson()`
  2. The toJson method converts the collection into JSON string:
  3. ```js
  4. const collection = collect({
  5. id: 384,
  6. name: 'Rayquaza',
  7. gender: 'NA',
  8. });
  9. const json = collection.toJson();
  10. // {"id": 384, "name": "Rayquaza", "gender": "NA"}
  11. ```
  12. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/toJson.js)