{"id":21401447,"url":"https://github.com/spoonx/json-statham","last_synced_at":"2025-07-13T21:31:47.646Z","repository":{"id":57285283,"uuid":"56181233","full_name":"SpoonX/json-statham","owner":"SpoonX","description":"Kick your JSON's ass, with json-statham's help.","archived":false,"fork":false,"pushed_at":"2016-09-15T13:50:14.000Z","size":157,"stargazers_count":23,"open_issues_count":0,"forks_count":4,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-09T01:17:39.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpoonX.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-13T19:47:37.000Z","updated_at":"2023-06-13T12:31:16.000Z","dependencies_parsed_at":"2022-09-09T00:41:13.101Z","dependency_job_id":null,"html_url":"https://github.com/SpoonX/json-statham","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Fjson-statham","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Fjson-statham/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Fjson-statham/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Fjson-statham/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpoonX","download_url":"https://codeload.github.com/SpoonX/json-statham/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225919522,"owners_count":17545275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T15:27:51.330Z","updated_at":"2024-11-22T15:27:51.991Z","avatar_url":"https://github.com/SpoonX.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-statham\n[![Build Status](https://travis-ci.org/SpoonX/json-statham.svg?branch=master)](https://travis-ci.org/SpoonX/json-statham)\n\nKick your JSON's ass, with json-statham's help. Extends [Homefront](https://github.com/SpoonX/homefront).\n\n![Statham is awesome man](./stathams.jpg)\n\nMakes working with javascript objects and json easy.\n\n## Installation\n`npm i --save json-statham`\n\n## Tests\n`npm test`\n\n## Usage\nThis module extends [Homefront](https://github.com/SpoonX/homefront). It's essentially the same, except for some additional methods, and an extended constructor.\n\n### Using Statham\nAll arguments are optional.\n\n```js\nlet Statham = require('json-statham').Statham;\nlet statham = new Statham({data: 'here'}, Statham.MODE_NESTED, 'path/to/file');\n```\n\n### Using .setFileLocation()\n```js\nlet Statham = require('json-statham').Statham;\nlet statham = new Statham();\n\nstatham.setFileLocation('./foo/ray-liotta.json'); // Used by .save()\n```\n\n### Using .save()\n```js\nlet Statham = require('json-statham').Statham;\nlet statham = new Statham();\n\nstatham.save().then(() =\u003e {/* Really does return a promise, I promise. */});\nstatham.save('./json-flemyng.json');        // Specific file\nstatham.save(true);                         // Create path for file, too\nstatham.save('./matt-schulze.json', true);  // Both options\n```\n\n### Using .fromFile(fileName[, ensureFileExists=false])\nThis method allows you to tell Statham to fetch the contents of a file itself. When `ensure` has been set to true, statham will create the provided file if it doesn't exist yet. This method returns a promise, and resolves with a statham instance (as described above).\n\n```js\nlet Statham = require('json-statham').Statham;\n\nStatham.fromFile(__dirname + '/my-data.json').then(statham =\u003e {\n  // Yeeeaaah, we have a statham instance now.\n});\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Fjson-statham","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspoonx%2Fjson-statham","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Fjson-statham/lists"}