refactor toJSON using map-stream