More Json functionality and unit tests to base/