{"_id":"@catalystic/json-to-yaml","name":"@catalystic/json-to-yaml","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@catalystic/json-to-yaml","version":"1.0.0","description":"catalystic package for converting json to yaml","type":"module","exports":"./build/index.js","types":"./build/index.d.ts","license":"ISC","scripts":{"bump":"pnpm version","typecheck":"tsc --noEmit"},"_id":"@catalystic/json-to-yaml@1.0.0","_integrity":"sha512-SsaxDB/JojD+bXv/UA1z5sUCfL0t2oP9qasyzIPhYHCh1JuFkd82Ip8D/81bjeaCFDsy2GiWqaVPcJD4+rXrqw==","_resolved":"/private/var/folders/r7/st3rby0s09j_tncy52bkhkpr0000gn/T/1e96c52dfadee3e4916f683b10667c98/catalystic-json-to-yaml-1.0.0.tgz","_from":"file:catalystic-json-to-yaml-1.0.0.tgz","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-SsaxDB/JojD+bXv/UA1z5sUCfL0t2oP9qasyzIPhYHCh1JuFkd82Ip8D/81bjeaCFDsy2GiWqaVPcJD4+rXrqw==","shasum":"72b1c50f15aeb283bf3e87cc7f9406896b87c016","tarball":"https://registry.npmjs.org/@catalystic/json-to-yaml/-/json-to-yaml-1.0.0.tgz","fileCount":4,"unpackedSize":4749,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB9C7rNOM9xWM8/12/lS9hTjijIiTXy2LrnTGKuUB6pwAiBHQSs+TvA4PBv5VHEGTmjnUjBoiStjefY2cepiQCK79Q=="}]},"_npmUser":{"name":"jaspreet23","email":"jaspreetsingh2379@gmail.com"},"directories":{},"maintainers":[{"name":"jaspreet23","email":"jaspreetsingh2379@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-to-yaml_1.0.0_1709126317114_0.9346287693493904"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-28T13:18:37.051Z","1.0.0":"2024-02-28T13:18:37.291Z","modified":"2024-02-28T13:18:37.834Z"},"maintainers":[{"name":"jaspreet23","email":"jaspreetsingh2379@gmail.com"}],"description":"catalystic package for converting json to yaml","license":"ISC","readme":"### json-to-yaml\r\n\r\n`@catalystic/json-to-yaml` is a javascript npm package to convert JSON data in YAML.   \r\n\r\nIt exports an `convert` function which intake JSON data and output YAML data.   \r\n\r\nYou can pass standard JSON or any Javascript object (with primitives, null only and same apply to any nested array or object), check examples below.\r\n\r\n\r\n## Usage\r\n\r\n**Using Javascript Object**\r\n```ts\r\nimport { convert } from \"@catalystic/json-to-yaml\";\r\n\r\nconst json = {\r\n  Type: \"AWS::AppSync::Resolver\",\r\n  DependsOn: \"GraphQLSchema\",\r\n  Properties: {\r\n    ApiId: { \"Fn::GetAtt\": \"GraphQLApi.ApiId\" },\r\n    DataSourceName: { \"Fn::GetAtt\": \"UserServiceLambdaDataSource.Name\" },\r\n    TypeName: \"Mutation\",\r\n    FieldName: \"createUser\",\r\n    Kind: \"UNIT\",\r\n    Runtime: {\r\n      Name: \"APPSYNC_JS\",\r\n      RuntimeVersion: \"1.0.0\",\r\n    },\r\n  },\r\n};\r\nconst yaml = convert(json);\r\n\r\n/* --- yaml ---\r\nType: \"AWS::AppSync::Resolver\"\r\nDependsOn: \"GraphQLSchema\"\r\nProperties:\r\n  ApiId:\r\n    Fn::GetAtt: \"GraphQLApi.ApiId\"\r\n  DataSourceName:\r\n    Fn::GetAtt: \"UserServiceLambdaDataSource.Name\"\r\n  TypeName: \"Mutation\"\r\n  FieldName: \"createUser\"\r\n  Kind: \"UNIT\"\r\n  Runtime:\r\n    Name: \"APPSYNC_JS\"\r\n    RuntimeVersion: \"1.0.0\"\r\n*/\r\n```\r\n**Using JSON data**\r\n```ts\r\nimport { readFileSync } from \"node:fs\";\r\nimport { convert } from \"@catalystic/json-to-yaml\";\r\n\r\nconst json = readFileSync(\"./file-name.json\");\r\nconst yaml = convert(json);\r\nconsole.log(yaml);\r\n```\r\n\r\n## Motivation\r\nOn searching the npm registry for some package to convert json to yaml, i stumbled upon\r\n[json-to-pretty-yaml](https://www.npmjs.com/package/json-to-pretty-yaml) which was last updated on 27th april 2018.\r\nAnd two of its dependencies were remedial and remove-trailing-whitespaces which were also last updated similarly.\r\nThe remove-trailing-whitespaces is a one-liner package and remedial is a very small package and they could use modern javascript functions and can be merged into one single ESM package and thus begin the effort to do so and give birth to @catalystic/json-to-yaml.\r\n","readmeFilename":"README.md"}