var JSONfo = require('../js/jam/jsonfo')

function C(tag) {
  this.text=tag;
  this.data={
    text:tag,
    id:function (id) {return id},
  }
}

C.prototype.print = function () { return this.text }


var o1 = new C('hello world');
var o2 = new C('hello world');
var o3 = new C('hello world');
var o4 = new C('hello world');

var data = {
  x:1,
  o:o2,
  a:[1,2,3],
  b:new Float64Array([1]),
  f:function (x) { return 'test'+x},
} 


var ser = JSONfo.serialize(data,{C:C});

print(ser)

var des = JSONfo.deserialize(ser,{C:C});

print(des)
print(des.o.print())