Hi There,
i have still the idea of creating json string in rules in my mind.
Question is now which packages to import or other question how do identify which packages are available for import.
Thanks
Thomas
Hi There,
i have still the idea of creating json string in rules in my mind.
Question is now which packages to import or other question how do identify which packages are available for import.
Thanks
Thomas
If it is listed here or here or here it is available for import.
I don’t see any JSON libraries so you might be better off using JavaScript transformations to generate and parse and/or JSR223 and write your Rules in JavaScript in the first place.
But really, if you are parsing and generating complicated JSON, such code properly belongs in a binding, not Rules.
At least i am looking for a structured text format to use it in different persistence thing. For example persist a dynamic assigned group or to describe a scene persist it and restore it automatically.
OK, if have to find another solution
Thanks
How complex? You might be able to use something like the Properties class. It is awkward if the data is really hierarchical.
https://docs.oracle.com/javase/7/docs/api/java/util/Properties.html
But you can put stuff into it and call toString and get it as a text string. You can store that text string and then create a new Properties class from that string.
XML is also available but that is going to be a whole lot of work to use in Rules.
You could also use a HashMap or other Map or List object and user serialization to encode/decode, but that will be more work than Properties I think.
Hi, how to know what is available for import? Can I import classes from ‘addons’ libraries?
https://docs.oracle.com/javase/8/docs/api/index.html
Everything that is part of the Java language can be imported.
You cannot import classes from add-in libraries.