Skip to content

Add json helper - #22

Merged
thekid merged 9 commits into
mainfrom
feature/json
Sep 27, 2025
Merged

thekid merged 9 commits into
mainfrom
feature/json

Conversation

@thekid

@thekid thekid commented Sep 27, 2025 •

Copy link
Copy Markdown
Member

This helper can be used to transport values from PHP to JavaScript:

<script>
  let person = {{&json person}};
  console.log(person.name);
</script>

See also https://stackoverflow.com/questions/10232574/need-handlebars-js-to-render-object-data-instead-of-object-object and https://laravel.com/docs/master/blade#rendering-json

@thekid thekid added the enhancement New feature or request label Sep 27, 2025
Comment thread composer.json
"xp-forge/frontend": "^7.0 | ^6.0",
"xp-forge/handlebars": "^10.0 | ^9.3",
"xp-forge/yaml": "^9.0 | ^8.0 | ^7.0 | ^6.0",
"xp-forge/json": "^6.0 | ^5.0",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not add a new dependency, xp-forge/json was already required by xp-forge/frontend.

@thekid
thekid merged commit 378f50e into main Sep 27, 2025
14 checks passed
@thekid
thekid deleted the feature/json branch September 27, 2025 10:42
@thekid

thekid commented Sep 27, 2025

Copy link
Copy Markdown
Member Author

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

Successfully merging this pull request may close these issues.

1 participant