Better way to convert string to JSON