converted to using json library