1 -- Additional path that may be required
2 package
.path
= package
.path
.. ';?/init.lua'
6 [[{1:[1213.3e12, 123 , 123, "hello", [12, 2], {1:true /*test*/}]}]],
7 [[{"username":"demo1","message":null,"password":""}]],
8 [[{"challenge":"b64d-fnNQ6bRZ7CYiNIKwmdHoNgl9JR9MIYtzjBhpQzYXCFrgARt9mNmgUuO7FoODGr1NieT9yTeB2SLztGkvIA4NXmN9Bi27hqx1ybJIQq6S2L-AjQ3VTDClSmCsYFPOm9EMVZDZ0jhBX1fXw3o9VYj1j9KzSY5VCSAzGqYo-cBPY\n.b64","cert":"b64MIIGyjCCBbKgAwIBAgIKFAC1ZgAAAAAUYzANBgkqhkiG9w0BAQUFADBZMRUwEwYKCZImiZPyLGQBGRYFbG9tp8uQuFjWGS_KxTHXz9vkLNFjOoZY2bOwzsdEpshuYSdvX-9bRvHTQcoMNz8Q9nXG1aMl5x1nbV5byQNTCJlz4gzMJeNfeKGcipdCj7B6e_VpF-n2P-dFZizUHjxMksCVZ3nTr51x3Uw\n.b64","key":"D79B30BA7954DF520B44897A6FF58919"}]],
9 [[{"key":"D79B30BA7954DF520B44897A6FF58919"}]],
10 [[{"val":undefined}]],
15 "Title": "View from 15th Floor",
17 "Url": "http://www.example.com/image/481989943",
21 "IDs": [116, 943, 234, 38793]
28 "Longitude": -122.3959,
30 "City": "SAN FRANCISCO",
37 "Latitude": 37.371991,
38 "Longitude": -122.026020,
46 [[[null,true,[1,2,3],"hello\"],[world!"] ]],
47 [[ [{"0":"tan\\\\","model\\\\":"sedan"},{"0":"red","model":"sports"}] ]],
48 [[ {"1":"one","2":"two","5":"five"} ]],
49 [=[ [[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] ]=]
52 for i
, v
in ipairs(testStrings
) do
53 print("Testing: #" .. i
)
54 local dec
= json
.decode(v
)
55 json
.util
.printValue(dec
, "JSONVALUE")
56 local reenc
= json
.encode(dec
)
57 print("RE_ENC: ", reenc
)
58 local redec
= json
.decode(reenc
)
59 json
.util
.printValue(redec
, "REDECJSONVALUE")
63 {[300] = {nil, true, 1,2,3, nil, 3}}
66 for _
, v
in ipairs(testValues
) do
67 local ret
= json
.encode(v
)
69 local dec
= json
.decode(ret
)
70 json
.util
.printValue(dec
, "Encoded value")
71 print("Re-encoded", json
.encode(dec
))