wro4j-extensions/src/main/java/ro/isdc/wro/extensions/script/RhinoScriptBuilder.java
public RhinoScriptBuilder addJSON() {
    try {
      final InputStream script = new AutoCloseInputStream(
          new WebjarUriLocator().locate(WebjarUriLocator.createUri("20110223/json2.js")));
      final InputStream scriptCycle = getClass().getResourceAsStream(SCRIPT_CYCLE);

      evaluateChain(script, SCRIPT_JSON);
      evaluateChain(scriptCycle, SCRIPT_CYCLE);
      return this;
    } catch (final IOException e) {
      throw new RuntimeException("Couldn't initialize json2.min.js script", e);
    }
  }
public RhinoScriptBuilder addJSON() {
    try {
      final InputStream script = new AutoCloseInputStream(
          new WebjarUriLocator().locate(WebjarUriLocator.createUri("20110223/json2.js")));
      final InputStream scriptCycle = getClass().getResourceAsStream(SCRIPT_CYCLE);

      evaluateChain(script, SCRIPT_JSON);
      evaluateChain(scriptCycle, SCRIPT_CYCLE);
      return this;
    } catch (final IOException e) {
      throw new RuntimeException("Couldn't initialize json2.min.js script", e);
    }
  }
public RhinoScriptBuilder addJSON ( ) { try { final InputStream script = new AutoCloseInputStream ( new WebjarUriLocator ( ) . locate ( WebjarUriLocator . createUri ( "20110223/json2.js" ) ) ) ; final InputStream scriptCycle = getClass ( ) . getResourceAsStream ( SCRIPT_CYCLE ) ; evaluateChain ( script , SCRIPT_JSON ) ; evaluateChain ( scriptCycle , SCRIPT_CYCLE ) ; return this ; } catch ( final IOException e ) { throw new RuntimeException ( "Couldn't initialize json2.min.js script" , e ) ; } }
This method will load JSON utility and aslo a Douglas Crockford's <a
href="https://github.com/douglascrockford/JSON-js/blob/master/cycle.js">utility</a> required for decycling objects
which would fail otherwise when using JSON.stringify.
This method will load JSON utility and aslo a Douglas Crockford s <a href = https : // github . com / douglascrockford / JSON - js / blob / master / cycle . js > utility< / a > required for decycling objects which would fail otherwise when using JSON . stringify .