Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

(This looks straightforward but I haven't tested yet)

The CloudShark Plugin for Wireshark uses/provides json.lua.

-- JSON4Lua: JSON encoding / decoding support for the Lua language.
-- json Module.
-- Author: Craig Mason-Jones
-- Homepage: http://json.luaforge.net/
-- Version: 0.9.50
-- This module is released under the MIT License (MIT).
-- Please see LICENCE.txt for details.
--
-- USAGE:
-- This module exposes two functions:
--   encode(o)
--     Returns the table / string / boolean / number / nil / json.null value as a JSON-encoded string.
--   decode(json_string)
--     Returns a Lua object populated with the data encoded in the JSON string json_string.


As used in cloudshark.lua:

               cdebug(string.format("Processing JSON response from %s", url))
               if response_page ~= "[]" then
                  parseok, response_json = pcall(json.decode, response_page)
               end