added read and write Json functions