Markdown Codeblock ``` and the json value has \n will make the result wrong.
How to reproduce
from json_repair import repair_json
print(repair_json("""```json
{
"greeting": "Dear Hank",
"bodys": [
"Thanks for your email.",
"The exact date and time for the AI phone project demo is this Friday.",
"I agree with rehearsing at least three times to ensure its success.",
"Yes, I will present for the demo along with my team."
],
"signature": "Best,\nJohnny"
```"""))
Run the code, it will print
{
"greeting": "Dear Hank",
"bodys": [
"Thanks for your email.",
"The exact date and time for the AI phone project demo is this Friday.",
"I agree with rehearsing at least three times to ensure its success.",
"Yes, I will present for the demo along with my team."
],
"signature": "Best", <--
"Johnny": "" <-- Breaked
}
Expected behavior
Print
{
"greeting": "Dear Hank",
"bodys": [
"Thanks for your email.",
"The exact date and time for the AI phone project demo is this Friday.",
"I agree with rehearsing at least three times to ensure its success.",
"Yes, I will present for the demo along with my team."
],
"signature": "Best"
}
Version of the library
0.30.0
Describe the bug
Markdown Codeblock ``` and the json value has \n will make the result wrong.
How to reproduce
Run the code, it will print
Expected behavior
Print