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

Convert CEL values to JSON #77

Merged
merged 9 commits into from
Aug 16, 2024
Merged

Convert CEL values to JSON #77

merged 9 commits into from
Aug 16, 2024

Conversation

clarkmcc
Copy link
Owner

@clarkmcc clarkmcc commented Aug 12, 2024

This PR adds support for converting CEL values to JSON values.

  1. Enable the JSON feature
    cel-interpreter = { ..., features = ["json"] }
  2. Use method on CEL values to convert to JSON
    let value = program.execute(&Context::default()).unwrap();
    let json = value.json().unwrap();

@clarkmcc
Copy link
Owner Author

CC'ing @jplock @alexsnaps since we've talked around this feature/issue in the past (see #68).

interpreter/src/json.rs Outdated Show resolved Hide resolved
@jplock
Copy link

jplock commented Aug 13, 2024

Tested the latest changes in this branch, works great. Thank you for the fix 👍

@clarkmcc clarkmcc merged commit 292b78c into master Aug 16, 2024
1 check passed
@clarkmcc clarkmcc deleted the json-support branch August 16, 2024 16:19
@github-actions github-actions bot mentioned this pull request Oct 14, 2024
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