Skip to content

Instantly share code, notes, and snippets.

@eleinadani
Created January 18, 2019 21:49
Show Gist options
  • Save eleinadani/bede50929c23557fd530d4137c4f22ca to your computer and use it in GitHub Desktop.
Save eleinadani/bede50929c23557fd530d4137c4f22ca to your computer and use it in GitHub Desktop.
// Create the JS runtime (aka, "Context")
Context cx = Context.create("js");
Value json = cx.eval("js", "(function(x,y) { return JSON.stringify({x:x,y:y}); })");
// Use the function
json.execute(42,43).asString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment