r0x0r / pywebview

Build GUI for your Python program with JavaScript, HTML, and CSS
https://pywebview.flowrl.com
BSD 3-Clause "New" or "Revised" License
4.7k stars 551 forks source link

Custom JSON encoders for js bridge call #1339

Closed XcantloadX closed 5 months ago

XcantloadX commented 6 months ago

Specification

Description

Custom JSON encoders will be helpful if you want to return a namedtuple or dataclass object.

Practicalities

r0x0r commented 6 months ago

Replacing json.dumps with orjson.dumps seems like a straightforward solution.

ylm-king commented 6 months ago

That's a good idea. There are many libraries that perform faster than json, and I myself have given up using json and replaced it with ujson or something else

r0x0r commented 6 months ago

I ran into a problem with orjson. There is no recipe for p4a, so it cannot be used on Android. There is an issue about adding a recipe in the p4a repo https://github.com/kivy/python-for-android/issues/3001 Let's wait until the support is added.

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 5 months ago

The message to post on the issue when closing it. If none provided, will not comment when closing an issue.