move the tojson() to a static class