setFieldValue automatically nests value that includes dot

🐛 Bug report

Current Behavior

When setting field value, if the value contains a “.” character, it will output a nested object in values prop.

Expected behavior

If the key contains a special character like “.” and it is not intended to be used as an object notation, formik should not nest it.

Reproducible example

onLineItemSelected =() => {
  const { setFieldValue, values } = this.props;
  setFieldValue('', true);  // values prop is { test: { dot: true}}

// ....
export default withFormik({
    mapPropsToValues: props => {
      const formValue = {};
      props.lineItems.forEach(lineItem => {
        formValue[] = false;
      return formValue;


Formik: ^1.5.8
React: 16.8.3
npm: 6.9.0
OS: Mac OS

1 possible answer(s) on “setFieldValue automatically nests value that includes dot

  1. So is there a way to disable this nesting behavior? I’m working with a list of item names that sometimes have dot character in them. Currently my fix is not using the setFieldValue method at all, instead I use setValues:

    onLineItemSelected = (key, data) => {
        const { values, setValues } = this.props;
        setValues({ ...values, [key]: data });