mpx / lua-cjson

Lua CJSON is a fast JSON encoding/parsing module for Lua

Home Page:https://kyne.au/~mark/software/lua-cjson.php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why “/” will be escaped

imilli opened this issue · comments

exp:
local t = {"ban/ana"}
local res = cjson.encode(t)
print(res)

the result is {"ban\/ana"}

But others json lib will not do this, exp jsoncpp.
If i have to do this, is there any way to avoid it?

This package has conservatively escaped characters just in case they cause a problem since it was initially written:
https://tools.ietf.org/html/rfc8259#page-9

Does escaping "/" cause a particular problem? Or is it cosmetic? This escaping is not configurable.

In hindsight, there is probably little reason to escape "/".