copy of https://bitbucket.org/tunnuz/json/src