Skip to content

Instantly share code, notes, and snippets.

@kasramp
Created April 7, 2020 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasramp/80a6256156aeed414180c2d1aa6cd172 to your computer and use it in GitHub Desktop.
Save kasramp/80a6256156aeed414180c2d1aa6cd172 to your computer and use it in GitHub Desktop.
val file = File("students.json")
val fileWriter = FileWriter(file, true)
val sequenceWriter = objectMapper.writerWithDefaultPrettyPrinter().writeValuesAsArray(fileWriter)
var pageNumber = 0
do {
val result = getStudentsDetailsByPage(pageNumber)
sequenceWriter.writeAll(result.content)
pageNumber += 1
} while (result.hasNext())
sequenceWriter.close()
@sadiksmart0
Copy link

I am adopting this concept to append to end of my json array but would like to know where getStudentDetailsByPage() is coming from.

My implementation append outside the array and never closes the ']'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment