I have to update the content of JSON file present on the server I am able to read the file using jsch lib but how to update the content is what I am struggling
sftpSession = jsch.getSession(sftpUser, host, sftpPort);
jsch.addIdentity(getBundle().getString("config.host.pemfile.location"));
JSch.setConfig(STRICT_HOSTKEY_CHECKIN_KEY, STRICT_HOSTKEY_CHECKIN_VALUE);
sftpSession.connect();
dbChannel = sftpSession.openChannel(CHANNEL_TYPE);
dbChannel.connect();
sftp = (ChannelSftp) dbChannel;
I am able to read the file from the path specified as below
try {
InputStream io = TestngListener.sftp.get(path);
rd = new BufferedReader(new InputStreamReader(io));
} catch (Exception e) {
e.printStackTrace();
}
How can I update the values of the file using jsch. any pointer in this would help.
content of file -
{"a": "value1", "b": "value2", "c": "value3"}
I need to update the value as per provided keys.