diff options
Diffstat (limited to 'lua/json2lua.lua')
| -rwxr-xr-x | lua/json2lua.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lua/json2lua.lua b/lua/json2lua.lua new file mode 100755 index 0000000..050b89d --- /dev/null +++ b/lua/json2lua.lua | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #!/usr/bin/env lua | ||
| 2 | |||
| 3 | -- usage: json2lua.lua [json_file] | ||
| 4 | -- | ||
| 5 | -- Eg: | ||
| 6 | -- echo '[ "testing" ]' | ./json2lua.lua | ||
| 7 | -- ./json2lua.lua test.json | ||
| 8 | |||
| 9 | local json = require "cjson" | ||
| 10 | local misc = require "cjson-misc" | ||
| 11 | |||
| 12 | local json_text = misc.file_load(arg[1]) | ||
| 13 | local t = json.decode(json_text) | ||
| 14 | print(misc.serialise_value(t)) | ||
