Added json export support but there are minor glitches