Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we make render support JsonSerializable? #526

Open
simensen opened this issue Jun 12, 2023 · 0 comments
Open

Can we make render support JsonSerializable? #526

simensen opened this issue Jun 12, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@simensen
Copy link

Even though I'm using Laravel, not all objects I'm passing as props are aware of Arrayable. In some cases, I'd like to be able to keep my objects closer to "pure PHP" and implement JsonSerializable. Given the nature of props ultimately being serialized to JSON anyway, this seems like a logical type to accept as a prop.

I'm happy to implement this, but I want to make sure I am correct that this makes sense and that the Inertia team wouldn't rather have this handled or implemented some other way. :)


My story:

I just lost time trying to figure out why the data I was sure I was saving wasn't being passed to the frontend correctly (always an empty object). It turns out my data was being selected and sent correctly. It's just that my generic Collection implementation implements JsonSerializable and not Arrayable so it was being "serialized to JSON" as an empty object.

@jessarcher jessarcher added the enhancement New feature or request label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants