Transform you JSON into java object, and insert it in the session before calling fireAllRules :
Object obj = your_JSON_2_Object_convert_method(....); session.insert(obj); session.fireAllRules(); ----- Mail original ----- De: "ihabo01" <ihab...@gmail.com> À: rules-users@lists.jboss.org Envoyé: Jeudi 8 Décembre 2011 18:07:30 Objet: [rules-users] Inserting Facts from Json Format Hello to all, I have the following simple rule: declare FlatData param1 : String param2 : String end rule "Test" when a:FlatData(param1=="something") then a.setParam2("hi"); end And I have the following code to load the rule: KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kBuilder.add(ResourceFactory.newFileResource("myRule.drl"),ResourceType.DRL); KnowledgeBaseConfiguration kBaseConfig = KnowledgeBaseFactory .newKnowledgeBaseConfiguration(); KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(kBaseConfig); kBase.addKnowledgePackages(kBuilder.getKnowledgePackages()); StatefulKnowledgeSession session = kBase.newStatefulKnowledgeSession(); session.fireAllRules(); And I have also the following object (in Json) that I would like to insert as a fact just before firing the rules: {"object":{" FlatData ":{"param1":"value1","param2":”value2”}}}} How can I achieve that? Many thanks in advance for your help Ihab -- View this message in context: http://drools.46999.n3.nabble.com/Inserting-Facts-from-Json-Format-tp3570810p3570810.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 _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users