0

v4 provides an API: ST.add(String, Object). I couldn't find the v3 API setAttributes(Object) in v4.

I used ST.add("root", JSONObject). An exception occures:

java.lang.IllegalArgumentException: no such attribute: root
        at org.stringtemplate.v4.ST.add(ST.java:223)
        at jjs.stst.STStandaloneTool.invokeTemplate(STStandaloneTool.java:479)
        at jjs.stst.STStandaloneTool.generate(STStandaloneTool.java:420)
        at jjs.stst.STStandaloneTool.main(STStandaloneTool.java:722)

Help is appreciated.

Gianmarco
  • 2,536
  • 25
  • 57

1 Answers1

0

add("root", JSONObject) should work, but "root" mast be declared in the template e.g. "mytemplate(root) ::= <>\n";