changed strings to objects in json serialization

to fix memory leak