How read file and convert from json to string? Example: i have file numbers.json [ "23423423", "234234234", "53453453" ]
And i want to have: String numbers = "'23423423', '234234234', '53453453'";
How read file and convert from json to string? Example: i have file numbers.json [ "23423423", "234234234", "53453453" ]
And i want to have: String numbers = "'23423423', '234234234', '53453453'";
svz
On
Path path = Paths.get(".../.../numbers.json");
List<String> listString= Files.readAllLines(path);
String result = listString.stream()
.map(String::valueOf)
.collect(Collectors.joining(""));
result = result.replace("\"", "\'");
result = result.replace("[", "");
result = result.replace("]", "");
return result;
this is how i code this, but i know, it looks so bad..
Here is the code, without using any kind of library, (assuming you only have json in form of single arrays like you have.
And you will have your numbers in the nums[] array.