toObject: simplification and slight performance improvement when value is a string.