Code Monkey home page Code Monkey logo

jaa's Introduction

Jaa

Vala samrt Json lib

example

using Jaa;
using Gee;

public class Mens :Object {

  public string firstName        {get ; set; default ="";}
  public string lastName         {get ; set; default ="";}
  public int    age              {get ; set; default = -1;}

  public Mens (){
    stdout.printf (" #########!!!!!!!!!!!!  \n");
  }
  public  void print_obj (){
    stdout.printf ("%s ######> %s ######> %i \n",this.firstName,this.lastName, this.age );
  }
}


public class JHumans : Object  {

	public string firstName         {get ; set; default = ""   ;}
	public string lastName          {get ; set; default = ""   ;}
	public string Name              {get ; set; default = ""   ;}
	public int    age               {get ; set; default = -1   ;}
	public double tall              {get ; set; default = -1.0 ;}
	public bool   married           {get ; set; default = false;}

	public Mens man                 {get ; set;} //construct
	public ArrayList<Mens> mens     {get ; set;}
	public ArrayList<int>  Numbers  {get ; set;}
	public ArrayList<string> Labels {get ; set;}

	public JHumans (){}

	construct{
		this.mens   = new ArrayList <Mens> ();
	}

  public void print_obj (){
    man.print_obj();

    mens.get(0).print_obj();
    mens.get(1).print_obj();
    stdout.printf ("%s => %s ==> %i : %s ## %.2f ## %s  \n",this.firstName,this.lastName ,
    			this.Numbers.get(1),this.Labels.get(1),
    			this.tall,this.married.to_string () );
  }
}

/**
 *
 */
public class Ones : GLib.Object {

  /**
   *
   */

  public JHumans Human     {get ;  set;}
  construct{
 		this.Human   = new JHumans  ();
 	}
  public Ones () {
    Human.print_obj();
    stdout.printf ("test age: %i\n", this.Human.age);
  }


}

int main () {

string str = """
	[
    {
      "Human":{
			"firstName"  : "Aissat",
			"lastName"   : "Abdou" ,
			"Name"       : "abdelwahab" ,
			"age"        : 26     ,
			"tall"       : 1.90  ,
			"married"    : true  ,
			"Numbers"    : [90,23,933] ,
			"Labels"     : ["foo","bar"],
			"man"        : {
				"firstName" : "Mohamed",
				"lastName"  : "aissat" ,
				"age"       : 29
				},
			"mens"        :
				[
					{ "firstName" : "Ali",
					  "lastName"  : "Ahmed",
					  "age"        : 26
					   },
					{ "firstName" : "Omar",
					  "lastName"  : "hani" ,
					  "age"        : 29
					}
				]
      }
		}
  ]""";

	JParser p = new JParser (str);

  JReaderArrayObject<Ones> test = new JReaderArrayObject<Ones>(p.node);
	stdout.printf ("test age: %i\n", test.get(0).Human.age);
	test.get(0).Human.print_obj();

	//JReaderObject<JHumans> tst = new JReaderObject<JHumans>(node);
	//tst.get_object().print_obj();

return 0;


}

jaa's People

Contributors

aissat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

semicodeos

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.