There is json.decode - I think a built in json.encode would be useful and logical.
There are other already made ways to do it but I think if json.decode exists so should json.encode for turning a lua table into JSON as a part of core api.
http://regex.info/blog/lua/json
http://lua-users.org/wiki/JsonModules