### 8.5.9. Normalize As Boolean

This section describes a procedure that can be used to translate string values to booleans.

The available procedure is described in the table below:

`call apoc.refactor.normalizeAsBoolean(entity, propertyKey, true_values, false_values)` | normalize/convert a property to be boolean

#### 8.5.9.1. Example Usage

The example below will help us learn how to use this procedure.

The following creates a graph containing nodes with boolean properties representented in different formats:

    CREATE (:Person {prop: 'Y', name:'A'}),
           (:Person {prop: 'Yes', name:'B'}),
           (:Person {prop: 'NO', name:'C'}),
           (:Person {prop: 'X', name:'D'})

We want to transform some properties into a boolean, `Y`, `Yes` into true and the properties `NO` into false. The other properties that don’t match these possibilities will be set as `null`.

The following normalizes all applicable boolean values for all nodes that have the `prop` property:

    MATCH (n)
    CALL apoc.refactor.normalizeAsBoolean(n,'prop',['Y','Yes'],['NO'])
    WITH n
    ORDER BY n.id
    RETURN n.prop AS prop

If we execute this query, we’ll see the following result: