better way of formatting/parsing json string