yoheinakajima / instagraph

Converts text input or URL into knowledge graph and displays
MIT License
3.27k stars 281 forks source link

changes in json sanitization (from PR49) #59

Closed snakajima closed 10 months ago

snakajima commented 10 months ago

Summary by CodeRabbit

coderabbitai[bot] commented 10 months ago

Walkthrough

The correct_json function in main.py has been refactored for better performance and error handling. The new implementation uses a while loop to remove trailing commas from JSON strings and includes error handling for JSONDecodeError.

Changes

File Summary
main.py The correct_json function now uses a while loop to remove trailing commas from JSON strings until none are found. It also includes error handling for JSONDecodeError, providing more informative error messages.

🐇

In the land of code, where the shadows lie,

A rabbit hopped, with a twinkle in its eye.

With each key press, a change was made,

A better function, in the code was laid.

No more trailing commas, no more decode fail,

On the path of clean code, we set sail! 🚀


Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - Mention `@coderabbitai` in any *review comment* for bot assistance. - Note: Review comments are made on code diffs or files, not on the PR overview. ### Pause Incremental Reviews - Insert `@coderabbitai: ignore` in the PR description to halt the bot's ongoing reviews. Remove the line to resume. - Additionally, enter `@coderabbitai pause` to halt the bot's ongoing reviews as any issue or review comment. To resume reviews, enter `@coderabbitai resume` as any issue or review comment.