{"id":25526437,"url":"https://github.com/rikilele/json2yaml","last_synced_at":"2026-04-10T23:03:27.641Z","repository":{"id":62421432,"uuid":"279893644","full_name":"rikilele/json2yaml","owner":"rikilele","description":"A Deno module that converts a JSON string to a (pretty) YAML string 🦕","archived":false,"fork":false,"pushed_at":"2021-07-12T12:08:01.000Z","size":48,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-17T19:05:11.836Z","etag":null,"topics":["deno","json","json2yaml","yaml"],"latest_commit_sha":null,"homepage":"https://deno.land/x/json2yaml","language":"TypeScript","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/rikilele.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2020-07-15T14:40:00.000Z","updated_at":"2023-01-20T14:25:16.000Z","dependencies_parsed_at":"2022-11-01T17:31:36.785Z","dependency_job_id":null,"html_url":"https://github.com/rikilele/json2yaml","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikilele%2Fjson2yaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikilele%2Fjson2yaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikilele%2Fjson2yaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikilele%2Fjson2yaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rikilele","download_url":"https://codeload.github.com/rikilele/json2yaml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239735235,"owners_count":19688262,"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":["deno","json","json2yaml","yaml"],"created_at":"2025-02-19T21:18:31.041Z","updated_at":"2026-01-05T22:30:19.433Z","avatar_url":"https://github.com/rikilele.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json2yaml\n\nA Deno module that converts a JSON string to a (pretty) YAML string 🦕\n\n![ci](https://github.com/Rikilele/json2yaml/workflows/CI/badge.svg)\n[![nest badge](https://nest.land/badge.svg)](https://nest.land/package/json2yaml)\n\n_Inspired by https://github.com/alexcrist/json-to-pretty-yaml_\n\n\u003e **Note**: there already exists a module\n\u003e ([`stringify()`](https://deno.land/std/encoding/#yaml)) to convert JavaScript\n\u003e objects to YAML strings in the Deno standard library. Consider using this\n\u003e instead if you prefer working with JavaScript objects!\n\n## Module\n\nBasic usage:\n\n```js\nimport { json2yaml } from \"https://deno.land/x/json2yaml/mod.ts\";\n\nconst jsonString = '{\"hello\": \"world\"}';\nconst yamlString = json2yaml(jsonString);\n\nconsole.log(yamlString);\n```\n\nOutput:\n\n```yaml\nhello: world\n```\n\nYou can also specify the number of spaces to use for indents:\n\n```js\nconst jsonString = '{\"foo\": [\"bar\", \"baz\"]}';\nconst yamlString = json2yaml(jsonString, 3);\n\nconsole.log(yamlString);\n```\n\nOutput:\n\n```yaml\nfoo:\n   -  bar\n   -  baz\n```\n\nFor more documentation, run:\n\n```sh\n$ deno doc mod.ts\n```\n\n## CLI\n\n```sh\n# Prints output to stdout\n$ deno run --allow-read https://deno.land/x/json2yaml/cli.ts -- input.json\n\n# Write contents into output.yaml\n$ deno run --allow-read https://deno.land/x/json2yaml/cli.ts -- input.json \u003e output.yaml\n```\n\nYou can also use `deno install` to easily create an alias command:\n\n```sh\n$ deno install -f --allow-read -n json2yaml https://deno.land/x/json2yaml/cli.ts\n\n# Much shorter!\n$ json2yaml -- input.json\n```\n\nExplanation:\n\n- `-f`: Forcefully overrides previous installations of json2yaml\n- `--allow-read`: Grants read access to the cli\n- `-n json2yaml`: Sets the alias to json2yaml\n\n## Testing\n\n```sh\n$ deno test --allow-read\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frikilele%2Fjson2yaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frikilele%2Fjson2yaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frikilele%2Fjson2yaml/lists"}