File: json2lua.lua

package info (click to toggle)
lua-cjson 2.1.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 528 kB
  • sloc: ansic: 5,207; sh: 73; makefile: 52; perl: 9
file content (14 lines) | stat: -rwxr-xr-x 304 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env lua

-- usage: json2lua.lua [json_file]
--
-- Eg:
-- echo '[ "testing" ]' | ./json2lua.lua
-- ./json2lua.lua test.json

local json = require "cjson"
local util = require "cjson.util"

local json_text = util.file_load(arg[1])
local t = json.decode(json_text)
print(util.serialise_value(t))