{"id":13686717,"url":"https://github.com/luizstacio/json-format","last_synced_at":"2025-03-24T02:32:03.286Z","repository":{"id":18601250,"uuid":"21806146","full_name":"luizstacio/json-format","owner":"luizstacio","description":"JSON format for good presentation.","archived":false,"fork":false,"pushed_at":"2017-07-19T02:11:51.000Z","size":7,"stargazers_count":25,"open_issues_count":0,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-06T13:15:57.279Z","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":"openhab/openhab2-addons","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luizstacio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-14T03:19:44.000Z","updated_at":"2023-08-16T07:29:54.000Z","dependencies_parsed_at":"2022-07-26T23:16:59.872Z","dependency_job_id":null,"html_url":"https://github.com/luizstacio/json-format","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizstacio%2Fjson-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizstacio%2Fjson-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizstacio%2Fjson-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizstacio%2Fjson-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luizstacio","download_url":"https://codeload.github.com/luizstacio/json-format/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221931696,"owners_count":16903799,"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-08-02T15:00:38.511Z","updated_at":"2024-10-28T20:36:45.648Z","avatar_url":"https://github.com/luizstacio.png","language":"JavaScript","readme":"json-format\n==========\n\n[![Build Status](https://travis-ci.org/luizstacio/json-format.svg?branch=master)](https://travis-ci.org/luizstacio/json-format.svg?branch=master)\n\nParse JavaScript Object to a JSON String indented.\n\n#### Instaling\n```\n  npm install json-format\n```\n\n#### Usage\n``` js\n  var jsonFormat = require('./');\n  var fs = require('fs');\n  var obj = {\n    a: 1,\n    b: 2\n  }\n\n  /* using config default, indent with tabs */\n  fs.writeFile('example_tabs.json', jsonFormat(obj), function(err){\n    if (err) throw err;\n    console.log('saved');\n  });\n\n  /* using indent with spaces */\n  var config = {\n    type: 'space',\n    size: 2\n  }\n\n  fs.writeFile('example_spaces.json', jsonFormat(obj, config), function(err){\n    if (err) throw err;\n    console.log('saved');\n  });\n```\n\n##### Result `example_tabs.json`\n``` json\n{\n    \"a\": 1,\n    \"b\": 2\n}\n```\n\n##### Result `example_spaces.json`\n``` json\n{\n  \"a\": 1,\n  \"b\": 2\n}\n```\n\n#### Default sizes\n``` json\n{\n  \"tab\": { \"size\": 1 },\n  \"space\": { \"size\": 4 }\n}\n```\n\n#### Config default\n``` json\n{\n  \"type\": \"tab\"\n}\n```\n\n[Based in this project](https://github.com/phoboslab/json-format).\n","funding_links":[],"categories":["Packages"],"sub_categories":["Formatter"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluizstacio%2Fjson-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluizstacio%2Fjson-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluizstacio%2Fjson-format/lists"}