Minor naming fix: nextOffset is a more correct name.
Add JSON serialization.