extra JSON formatting logic