java - JSON Replacing '.' with -
i want program takes json file input , results json file. input file contains like:
{"empname":"surname.firstname","department.name":"production","salary":11254.42}
the output file must replace '.'(dot) '_'(underscore) of input json. expecting output:
{"empname":"surname_firstname","department_name":"production","salary":11254_42}
i want program using java, without using serialization , deserialization. can 1 help?
if using java 7+:
string str = new string(files.readallbytes(paths.get("in.json")), standardcharsets.utf_8) .replace('.', '_'); files.write(paths.get("out.json"), str.getbytes("utf-8"), standardopenoption.write);
Comments
Post a Comment