Ask Your Question

Parse JSON data in lua dissector

asked 2022-08-27 13:30:11 +0000

bq gravatar image


In a dissector written in LUA, I would like to convert json string to object.

Is there any library that I could call from the dissector ?

edit retag flag offensive close merge delete


solved ! Thanks !

bq gravatar imagebq ( 2022-08-28 17:05:25 +0000 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-08-27 18:14:34 +0000

Chuckc gravatar image

(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:
-- Version: 0.9.50
-- This module is released under the MIT License (MIT).
-- Please see LICENCE.txt for details.
-- 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)
edit flag offensive delete link more


I have got this library from It works well from my dissector !

Thank you very much !

bq gravatar imagebq ( 2022-08-28 17:04:11 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2022-08-27 13:30:11 +0000

Seen: 915 times

Last updated: Aug 27 '22