added function generate json