Stop memory leaks in JSON coder
Fixing data/set_data in JSON coder. Added test.
Minor change to tests.