Bug fix. When writing to JSON, data needs to be rebuilt explicitly