json_formatted_str is a string, and iterating through a string will yield the individual characters. You probably want something like for line in json_formatted_str.split("\n")
json_formatted_str
for line in json_formatted_str.split("\n")