What you can do is read each line and put them in a TreeSet<String> and it will automatically sort it using natural order.

// Json