Examples of deserializeFromJson()


Examples of com.skaringa.javaxml.ObjectTransformer.deserializeFromJson()

      // The script converts the JSON string into an object, sets the attribute 'firstName' to 'Horst'
      // and converts the object back to JSON string
      InputStream convertedJson = execPHP("$person = json_decode($_ARGV[0]);$person->firstName = 'Horst'; fwrite(STDOUT, json_encode($person));", json);
     
      // Read JSON from PHP back into person
      Person horst = (Person) trans.deserializeFromJson(convertedJson, Person.class);
      convertedJson.close();

      // Check the result.
      if ("Horst".equals(horst.getFirstName())) {
        System.out.println("Horst OK");
View Full Code Here

Examples of com.skaringa.javaxml.ObjectTransformer.deserializeFromJson()

      out.close();

      // Read a Person's JSON file and create a new Person object
      // from its content.
      FileInputStream in = new FileInputStream("fred.js");
      Person freddy = (Person) trans.deserializeFromJson(in, Person.class);
      in.close();

      // Check the result.
      if (fred.equals(freddy)) {
        System.out.println("OK");
View Full Code Here

Examples of com.skaringa.javaxml.ObjectTransformer.deserializeFromJson()

        System.out.println("ERROR");
      }
     
      // now deserialize the JSON file into a map instead of a person
      in = new FileInputStream("fred.js");
      Map fredMap = (Map) trans.deserializeFromJson(in);
      in.close();
     
      System.out.println(fredMap);
    } catch (NoImplementationException e) {
      System.err.println(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.