{"id":19814632,"url":"https://github.com/windsting/json2lua","last_synced_at":"2025-05-01T10:31:15.147Z","repository":{"id":25925924,"uuid":"106907698","full_name":"windsting/json2lua","owner":"windsting","description":"A command-line utlity to convert JSON to LUA, meaning from a .json file to a .lua file.","archived":false,"fork":false,"pushed_at":"2024-04-01T14:55:23.000Z","size":90,"stargazers_count":3,"open_issues_count":5,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T12:42:19.547Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/windsting.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-14T07:26:34.000Z","updated_at":"2024-11-21T02:58:18.000Z","dependencies_parsed_at":"2024-11-12T10:02:00.313Z","dependency_job_id":null,"html_url":"https://github.com/windsting/json2lua","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windsting%2Fjson2lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windsting%2Fjson2lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windsting%2Fjson2lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windsting%2Fjson2lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/windsting","download_url":"https://codeload.github.com/windsting/json2lua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251859857,"owners_count":21655629,"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-12T10:01:45.719Z","updated_at":"2025-05-01T10:31:14.880Z","avatar_url":"https://github.com/windsting.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json2lua\n\nA cli utility AND package to convert JSON to LUA, meaning from a `.json` file to a `.lua` file.\n\n![demo-gif](https://github.com/windsting/json2lua/raw/master/asset/json2lua-demo.gif)\n\n## installation\n\n    \u003e npm install -g json2lua\n\n**Note:** To use both `npm` and `json2lua`, you must have [NodeJS](https://nodejs.org/en/) installed on the machine.\n\n## usage\n\n1. **as cli command**\n\n    Specify a `.json` to read and a `.lua` file name for output.\n\n        \u003e json2lua test.json test.lua\n\n1. **as package**\n\n    Install it in your project folder:\n\n        \u003e npm install json2lua\n\n    then **require** it in source code and use it:\n\n        const json2lua = require('json2lua'),\n            jsonStr = `{\"id\":1,\"name\":\"dog\",\"price\":200}`;\n\n        //output is:\n        //{[\"id\"] = 1,[\"name\"] = \"dog\",[\"price\"] = 200}\n        console.log(json2lua.fromString(jsonStr));\n\n    The [testing file](./test/test.js) showed usages for all 3 valid method, and the parameter `dstFileName` is optional, omit it if you do not need an output file.\n\n## Example\n\nFrom input file **test.json**:\n\n```json\n[\n  {\n    \"id\": 1,\n    \"name\": \"dot\",\n    \"desc\": \"typo for dog\",\n    \"price\": 3000,\n    \"passwordServerOnly\": \"ddd\",\n    \"skinClientOnly\": \"dot-123.jpg\"\n  },\n  {\n    \"id\": 9,\n    \"name\": \"milk\",\n    \"desc\": \"feed with this\",\n    \"price\": 42,\n    \"passwordServerOnly\": \"mkkk\",\n    \"skinClientOnly\": \"white.bmp\"\n  }\n]\n```\n\nGot result file **test.lua**:\n\n```lua\n{{[\"id\"] = 1,[\"name\"] = \"dot\",[\"desc\"] = \"typo for dog\",[\"price\"] = 3000,[\"passwordServerOnly\"] = \"ddd\",[\"skinClientOnly\"] = \"dot-123.jpg\"},{[\"id\"] = 9,[\"name\"] = \"milk\",[\"desc\"] = \"feed with this\",[\"price\"] = 42,[\"passwordServerOnly\"] = \"mkkk\",[\"skinClientOnly\"] = \"white.bmp\"}}\n```\n\n**Note:** Sorry for the readability of output .lua file, for most cases, it should be read by machine, I assume that machine doesn't complain.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindsting%2Fjson2lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwindsting%2Fjson2lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindsting%2Fjson2lua/lists"}