{"id":13588690,"url":"https://github.com/any-json/any-json","last_synced_at":"2025-04-08T06:32:32.016Z","repository":{"id":26801924,"uuid":"30260374","full_name":"any-json/any-json","owner":"any-json","description":"Convert (almost) anything to JSON","archived":true,"fork":false,"pushed_at":"2022-02-01T19:32:19.000Z","size":94,"stargazers_count":147,"open_issues_count":2,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-03T11:42:12.468Z","etag":null,"topics":["converter","json","maintainer-wanted"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/any-json","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/any-json.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":"2015-02-03T19:27:42.000Z","updated_at":"2024-09-18T09:55:54.000Z","dependencies_parsed_at":"2022-07-08T10:31:27.554Z","dependency_job_id":null,"html_url":"https://github.com/any-json/any-json","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/any-json%2Fany-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/any-json%2Fany-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/any-json%2Fany-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/any-json%2Fany-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/any-json","download_url":"https://codeload.github.com/any-json/any-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247707976,"owners_count":20982883,"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":["converter","json","maintainer-wanted"],"created_at":"2024-08-01T15:06:52.097Z","updated_at":"2025-04-08T06:32:27.288Z","avatar_url":"https://github.com/any-json.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# any-json\n\nany-json can be used to convert (almost) anything to and from JSON.\n\n[![NPM version](https://img.shields.io/npm/v/any-json.svg?style=flat-square)](http://www.npmjs.com/package/any-json)\n\n## Install from npm\n\n```\nnpm install any-json -g\n```\n\n## Examples\n\n### convert\n\n```bash\n# Prints as JSON to standard out\nany-json package.json5\n\n# Writes the contents from `package.json` to `package.json5` as JSON5\nany-json package.json package.json5\n\n# Same as above (the `convert` command is default).\nany-json convert package.json5\nany-json convert package.json package.json5\n```\n\n### combine\n\n```bash\n# Prints an JSON array containing an item for every JSON file in directory\nany-json combine *.json\n\n# Combines A.json and B.json, writing the result to C.json\nany-json combine A.json B.json --out C.json\n\n# Create a csv from a collection of flat YAML files\nany-json combine *.yaml --out=data.csv\n```\n\n### split\n\n```bash\n# Creates a JSON file for each row in the CSV where the name is based on the `product_id` column\nany-json split products.csv prod-{product_id}.json\n```\n\n## Formats and Data Safety\n\n### Safe\n\nWhen only JSON features are used, conversion should not result in any data loss when using these formats.\n\n- cson\n- hjson\n- json\n- json5\n- yaml\n\n### Problematic\n\nSome loss of information may occur.  Improved parsers/serializers could provide better compatibility, but implementation is provided as-is.  Known issues are listed below the format.\n\n- ini\n  - All numbers are converted to strings (the `ini` library would need to quote strings in order be recognize numbers)\n  - In the unlikely case an object was not an array but has only has sequential, numeric members starting at zero it will be decoded as an array.\n- toml\n  - Top-level array and date objects are not supported\n    - It would be non-standard, but this could be worked around by wrapping the content in an object (then discarding the object when decoding).\n- xml\n  - It cannot parse its own output [node-xml2js#391](https://github.com/Leonidas-from-XIV/node-xml2js/issues/391)\n\n### Limited\n\nThese formats are conceptually different and only work on a limited basis.  With effort, conventions could be established to provide a more complete transfer but there will be some impedance.\n\nTabular formats:\n- csv\n- xls\n- xlsx\n\n## Usage\n\n### Command Line\n\n```\nusage: any-json [command] FILE [options] [OUT_FILE]\n\nany-json can be used to convert (almost) anything to JSON.\n\nThis version supports:\n    cson, csv, hjson, ini, json, json5, toml, yaml\n\nThis version has is beta support for:\n    xls, xlsx\n\nThe beta formats should work, but since they are new,\n  behavior may change in later releases in response to feedback\n  without requiring a major version update.\n\ncommand:\n    convert    convert between formats (default when none specified)\n    combine    combine multiple documents\n    split      spilts a document (containing an array) into multiple documents\n\noptions:\n    -?, --help              Prints this help and exits.\n    --version               Prints version information and exits.\n    --input-format=FORMAT   Specifies the format of the input (assumed by file\n                            extension when not provided).\n    --output-format=FORMAT  Specifies the format of the output (default: json or\n                            assumed by file extension when available).\n\n  combine (additional options):\n    --out=OUT_FILE          The output file.\n```\n\n### API\n\n```js\nconst anyjson = require('any-json')\nconst obj = await anyjson.decode(/* string to parse */, /* format (string) */)\nconst str = await anyjson.encode(/* object to encode */, /* desired format (string) */)\n```\n\n## Contributing\n\nContributions welcome!  If **any-json** is not meeting your needs or your have an idea for an improvement, please open an issue or create a pull request.\n\n## History\n\n_For detailed release history, see [Releases](https://github.com/any-json/any-json/releases)._\n\n- v3 Re-written to be Promise-based and bi-directional (serialization capabilities as well as parsing).\n- v2 removed the experimental/unreliable format detection.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fany-json%2Fany-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fany-json%2Fany-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fany-json%2Fany-json/lists"}