Note that there are some explanatory texts on larger screens.

plurals
  1. POPyYaml to SnakeYaml --- AWT-EventQueue-0" Can't construct a java object for tag:yaml.org,2002:java/object:
    primarykey
    data
    text
    <p>I am passing Yaml created with PyYaml to SnakeYaml and Snakeyaml does not seem to recognize anything beyond the first line where !! exists and python/object is declared. I already have identical objects setup in Java. Is there an example out there that shows a loadAll into an object array where the object type is asserted or assigned?</p> <hr> <p>Good call... was away from the computer when I originally posted.</p> <p>Here is the data from PyYaml that I am trying to use SnakeYaml to get into a Java application:</p> <pre><code>--- !!python/object:dbmethods.Project.Project {dblogin: kirtstrim7900, dbname: 92218kirtstrim_wfrogls,dbpw: 1234567895#froggy, preference1: '', preference2: '', preference3: '', projName: CheckPoint Firewall Audit - imp, projNo: 1295789430544+CheckPoint Firewall Audit - imp, projectowner: kirtcathey@sysrisk.com,result1label: Evidence, result2label: Recommend, result3label: Report, resultlabel: Response,role: owner, workstep1label: Objective, workstep2label: Policy, workstep3label: Guidance,worksteplabel: Procedure} </code></pre> <p>Not just a single instance of the above, but several objects, so need to use loadAll in SnakeYaml.... unless somebody knows better.</p> <p>As for the code, this is all I have from SnakeYaml docs:</p> <pre><code>for (Object data : yaml.loadAll(sb.toString())) { System.out.println(data.toString()); } </code></pre> <p>Then, this error is thrown:</p> <pre><code>Exception in thread "AWT-EventQueue-0" Can't construct a java object for tag:yaml.org,2002:java/object: ...... Caused by: org.yaml.snakeyaml.error.YAMLException: Class not found: ...... </code></pre> <p>As you can see from the small code snippet, EVEN without all this information supplied, anybody who knows the answer about how to cast an object arbitrarily could PROBABLY answer the question.</p> <p>Thx.</p> <p>Parsed off the two exclamation points (!!) at the beginning of each entry and now I get: mapping values are not allowed here in "", line 1, column 73:</p> <p>as an error. The whole point of using YAML was to reduce coding related to parsing. If I have to turn around and parse incoming and outgoing code for whatever reason, then YAML sucks!! And will gladly revert back XML or anything else that will allow a python middleware to talk to a java application.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload