Fix JSON creation functionality