EAGLESIX-3144 fix toJSON bug

Not in the original source code