Skip to content

returned JSON is escaping & so we need to unescape it before fetching#6

Open
NiltonVolpato wants to merge 1 commit into
usetrmnl:mainfrom
NiltonVolpato:main
Open

returned JSON is escaping & so we need to unescape it before fetching#6
NiltonVolpato wants to merge 1 commit into
usetrmnl:mainfrom
NiltonVolpato:main

Conversation

@NiltonVolpato
Copy link
Copy Markdown

  • adds a json function to extract simple fields from a json file (handling basic unescaping)
  • handles more error conditions
  • other small refactoring

* adds a `json` function to extract simple fields from a json file
* handles more error conditions
* other small refactorings
@schappim
Copy link
Copy Markdown
Contributor

Hi Nilton,

Thanks again for the PR! I wanted to give a bit of context on the image_url extraction and unescaping, just to make sure we’re aligned.

Currently, we’re already unescaping \u0026 inline using a simple sed pipe after extracting image_url. This has been working reliably for the current API responses. I noticed your PR wraps this in a reusable json() function, which is neat, but it also adds more sed-based parsing (and some complexity) that might not hold up well for edge cases or more deeply nested structures.

Since we’re already relying on predictable top-level keys (image_url, refresh_rate, etc), I think sticking with the current lightweight inline parsing is a bit more robust for our shell environment; and avoids duplicating logic or introducing failure points (e.g., on unexpected whitespace or nesting).

Would you be okay reverting the new json() function for now, and keeping the original inline sed usage? If we need richer JSON parsing in future, I think you're on the right path!

Really appreciate the contribution; just want to keep it as stable and simple as possible given the constraints of Kindle’s shell.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants