{"id":13496152,"url":"https://github.com/tiye/json-lua","last_synced_at":"2025-04-10T02:12:14.425Z","repository":{"id":58524907,"uuid":"38113002","full_name":"tiye/json-lua","owner":"tiye","description":"JSON encoder/decoder","archived":false,"fork":false,"pushed_at":"2022-04-07T17:48:39.000Z","size":26,"stargazers_count":56,"open_issues_count":2,"forks_count":20,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-10T02:11:53.969Z","etag":null,"topics":["formatter","json","lua"],"latest_commit_sha":null,"homepage":"http://luarocks.org/modules/jiyinyiyong/json-lua","language":"Lua","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/tiye.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":"2015-06-26T13:36:35.000Z","updated_at":"2025-04-03T06:47:02.000Z","dependencies_parsed_at":"2022-09-12T05:01:29.579Z","dependency_job_id":null,"html_url":"https://github.com/tiye/json-lua","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/tiye%2Fjson-lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiye%2Fjson-lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiye%2Fjson-lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiye%2Fjson-lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiye","download_url":"https://codeload.github.com/tiye/json-lua/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142905,"owners_count":21054671,"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":["formatter","json","lua"],"created_at":"2024-07-31T19:01:43.057Z","updated_at":"2025-04-10T02:12:14.398Z","avatar_url":"https://github.com/tiye.png","language":"Lua","readme":"\nJSON.lua\n----\n\nThis project was originally created by Jeffrey Friedl: http://regex.info/blog/lua/json\n\nThis repo is forked for LuaRocks.\n\n### Usage\n\nBy running Luarocks you will actually get a `/usr/local/share/lua/5.2/JSON.lua`.\n\n```\nluarocks install json-lua\n```\n\nAnd then you may import code like this:\n\n```lua\nJSON = require(\"JSON\")\ninspect = require(\"inspect\")\n\nlocal raw_json_text = \"[1,2,[3,4]]\"\n\nlocal lua_value = JSON:decode(raw_json_text) -- decode example\nlocal raw_json_text    = JSON:encode(lua_value)        -- encode example\nlocal pretty_json_text = JSON:encode_pretty(lua_value) -- \"pretty printed\" version\n\nprint(inspect(lua_value))\nprint(inspect(raw_json_text))\nprint(inspect(pretty_json_text))\n```\n\nOutput:\n\n```kua\n{ 1, 2, { 3, 4 } }\n\"[1,2,[3,4]]\"\n\"[ 1, 2, [ 3, 4 ] ]\"\n```\n\nNotice that `encode_pretty` is not indented style. And it's a bug need to be fixed.\n\n### array_newline option\n\n```lua\nlocal pretty_json_text = JSON:encode_pretty(lua_value, nil, \n           { pretty = true, align_keys = false, array_newline = true, indent = \"|   \" })\nprint(pretty_json_text)\n```\n\nOutput:\n\n```kua\n[\n|   1,\n|   2,\n|   [\n|   |   3,\n|   |   4\n|   ]\n]\n```\n \n\n### Test\n\n```\nlua test.lua\n```\n\n### License\n\nhttp://creativecommons.org/licenses/by/3.0/deed.en_US\n","funding_links":[],"categories":["Lua"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiye%2Fjson-lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiye%2Fjson-lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiye%2Fjson-lua/lists"}