Wolfgang, Thanks again for the reply! However, after much testing, I'm still having problems with Drools Server parsing the JSON array. My current test DRL is:
============================== package com.foobar declare Person name: String hobbies: java.util.ArrayList end rule "Person" dialect "mvel" when $p : Person(); then $p.name = $p.name + " has hobby size of " + $p.hobbies.size(); end =============================== and my current JSON msg sent to the Drools Server (via TCPMON) is: =============================== { 'insert': { 'out-identifier': '123', 'object': { 'com.foobar.Person': { "name":"fulton", "hobbies": [123] } } } } ============================== The above JSON will be inserted successfully, but the result shows that $p.hobbies.size() returns "0". If I add another element to the JSON array (e.g., [123,345]), I get the following Xstream exception: ============================== com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$DuplicateFieldException: hobbies ---- Debugging information ---- duplicate-field : hobbies class : org.drools.command.runtime.rule.InsertObjectCommand required-type : com.foobar.Person line number : -1 ------------------------------- at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$SeenFields.add(AbstractReflectionConverter.java:322) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:234) =============================== If I modify the JSON array to contain objects (e.g., [{"abc":"123"},{"cdf":"345"}]), which is what I'm ultimately desiring, then I get the following exception: =============================== com.thoughtworks.xstream.converters.ConversionException: 123 : 123 : 123 : 123 ---- Debugging information ---- message : 123 : 123 cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException cause-message : 123 : 123 class : org.drools.command.runtime.rule.InsertObjectCommand required-type : java.util.ArrayList line number : -1 ------------------------------- at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:89) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76) =============================== Am I missing something in the DRL declaration? Do the array elements need to be declared somehow (if so, how?)? Can Xstream unmarshal the JSON array into an ArrayList? I can move this thread to the Xstream forum (if there is one), if you'd like, but if there's a simple answer here, then I'd greatly appreciate it! Thanks again for your help! -- View this message in context: http://drools.46999.n3.nabble.com/How-to-declare-an-array-attribute-within-an-object-in-a-DRL-file-tp2867666p2872022.html Sent from the Drools: User forum mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users