Jasonette / Jasonette/JASONETTE-Android

Use Webview as the JS engine for Jasonette JSON processing

Open
#162 7 comments 0 reactions 1 assignee Claimed by @maks View on GitHub
enhancement in progress
Dominant language
Java
Stars
1.6k
Forks
266
PR merge metrics
No merged PRs in 30d

Description

Currently j2v8 is used to process jasonette JSON using parser (written in JS) as well as for the convert CSV/RSS -> JSON action.
This brings in a large shared native library into the APK, that is then needed for each architecture supported by Jasonette android app (currently ony ARM and x86).
Instead the Android Webview can be used for this as it already ships with v8 (except in older devices where JSC is used) and from API19 the `evaluateJS()` method is available which provides all the functionality currently used by jasonette from j2v8. For android versions older than 19, the `loadUrl()` method can be used **BUT** in this case parser.js and csv/rss parsers will need to be modified to return values via the JS->Java interface.
eg.
```
var wrapped_json = function(template, data, json) {
var result = json(template, data, json);
if (JAVARESULT) {
JAVARESULT.result(result);
}
return result;
}
```
Where `JAVARESULT` woould be a Java object added via the `webview.addJavascriptInterface()` to the webview and has a `result(String s)` method.

Added benefit is that the webview being used to process the jasonette json can be remotely debugged via Chrome Dev Tools.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.