Skip to content

emmericp/json.lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Lightweight Lua <-> JSON encoder/decoder extracted from Prosody.

Why use it from this repository instead of copying it directly from Prosody?

I've fixed a minor inconvenience when handling NaN and infinity. JSON not supporting these special IEE 754 values is a common problem and the original code, like many implementations, generates invalid JSON when encountering NaN or infinity.

This implementation generates strings instead which is slightly better than invalid JSON for my application. Other applications might be just fine with whatever tostring(nan/infinity) produces (note that the output is platform-dependent).

Why not use any of the 100 other modules?

I didn't want a dependency on LPeg and this implementation seems to be quite mature as it has been used for years in Prosody.

About

Lightweight json encoder and decoder extracted from Prosody: http://hg.prosody.im/trunk/file/tip/util/json.lua

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages