Lua GetJson on boolean value


trying to export Orthanc configuration to remote server with LUA :

function Initialize() local conf = GetOrthancConfiguration() SetHttpCredentials('username', 'password') local result = HttpPost('/my/server/uri', DumpJson(conf)) PrintRecursive(result) end

orthanc log shows following line for each boolean value in orthanc config, and config is received by server with null value for all boolean values (true or false) :

LuaContext.cpp:502] Unsupported Lua type when returning Json

In orthanc config files, boolean values are well formatted. For example :

“HttpServerEnabled” : true,


In fact, in LuaContext.cpp boolean values are treated as boolean only if keepStrings parameter is false, but orthanc documentation says :

Setting the optional argument keepStrings to true prevents the automatic conversion of strings to integers.

Boolean are neither strings nor integers, so why are they concerned by this ? BTW it seems that lua_isstring function don’t work with integers, so they should always be treated as integers, no ?


Erratum :

In the LUA code there is a second param to true (for keepStrings) to DumpJson :

function Initialize()
local conf = GetOrthancConfiguration()
SetHttpCredentials(‘username’, ‘password’)
local result = HttpPost(‘/my/server/uri’, DumpJson(conf, true))



Dear Marc,

Sorry for the delay and thanks for reporting the problem!

Your issue is now fixed in the mainline:

For future reference, you will find 2 files attached to this message in order to reproduce the issue:

  • “node-echo.js” is a simple Node.js server that simply echos the body of incoming HTTP POST requests.
  • “booleans.lua” is Marc’s script, modified so that it uses the “node-echo.js” server.


node-echo.js (623 Bytes)

booleans.lua (230 Bytes)