compat:json_escape_forward_slash - Totktonada/test-wiki-subpages Wiki

JSON encode escape forward slash

For unknown reason in upstream lua_cjson '/' was escaped while according to the standard [rfc4627] it is unnecessary and is questionably compatible with other implementations.

Old and new behavior

tarantool.compat lets you chose between json encoder escaping '/' and not. To make it less confusing, msgpuck encoder also changes accordingly, providing unified encoding style for log.info().

You can select new/old behavior in tarantool.compat. It will affect global serializer instance and all others created with json.new() afterwards.

Known compatibility issues

At this point we do not know any incompatible modules.

Detecting issues in you codebase

Both encoding styles are correct from JSON standart's standpoint, but if your module relies on encodings results bytewise, it may break with this change. Be cautious if you do the following:

  • hash results of json.encode()