# ConstraintSetParser

Artifact: [androidx.constraintlayout:constraintlayout-core](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/core/state/ConstraintSetParser.java+class:androidx.constraintlayout.core.state.ConstraintSetParser) Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

*** ** * ** ***


```
public class ConstraintSetParser
```

<br />

*** ** * ** ***

## Summary

| ### Nested types |
|---|
| `public class https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser.DesignElement` |
| `public class https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser.LayoutVariables` Provide the storage for managing Variables in the system. |
| `public enum https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser.MotionLayoutDebugFlags` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser#ConstraintSetParser()()` |

| ### Public methods |
|---|---|
| `static void` | `https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser#parseDesignElementsJSON(java.lang.String,java.util.ArrayList<androidx.constraintlayout.core.state.ConstraintSetParser.DesignElement>)( https://developer.android.com/reference/java/lang/String.html content, https://developer.android.com/reference/java/util/ArrayList.html<https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser.DesignElement> list )` parse the Design time elements. |
| `static void` | `https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser#parseJSON(java.lang.String,androidx.constraintlayout.core.state.State,androidx.constraintlayout.core.state.ConstraintSetParser.LayoutVariables)( https://developer.android.com/reference/java/lang/String.html content, https://developer.android.com/reference/androidx/constraintlayout/core/state/State state, https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser.LayoutVariables layoutVariables )` Top leve parsing of the json ConstraintSet supporting "Variables", "Helpers", "Generate", guidelines, and barriers |
| `static void` | `https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser#parseJSON(java.lang.String,androidx.constraintlayout.core.state.Transition,int)(https://developer.android.com/reference/java/lang/String.html content, https://developer.android.com/reference/androidx/constraintlayout/core/state/Transition transition, int state)` Parse and populate a transition |
| `static void` | `https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser#parseMotionSceneJSON(androidx.constraintlayout.core.state.CoreMotionScene,java.lang.String)(https://developer.android.com/reference/androidx/constraintlayout/core/state/CoreMotionScene scene, https://developer.android.com/reference/java/lang/String.html content)` Parse and build a motionScene this should be in a MotionScene / MotionSceneParser |

## Public constructors

### ConstraintSetParser

Added in 1.1.2

```
public ConstraintSetParser()
```

## Public methods

### parseDesignElementsJSON

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static void parseDesignElementsJSON(
    String content,
    ArrayList<ConstraintSetParser.DesignElement> list
)
```

parse the Design time elements.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html content` | the json |
| `https://developer.android.com/reference/java/util/ArrayList.html<https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser.DesignElement> list` | output the list of design elements |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/parser/CLParsingException` |   |

### parseJSON

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static void parseJSON(
    String content,
    State state,
    ConstraintSetParser.LayoutVariables layoutVariables
)
```

Top leve parsing of the json ConstraintSet supporting "Variables", "Helpers", "Generate", guidelines, and barriers

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html content` | the JSON string |
| `https://developer.android.com/reference/androidx/constraintlayout/core/state/State state` | the state to populate |
| `https://developer.android.com/reference/androidx/constraintlayout/core/state/ConstraintSetParser.LayoutVariables layoutVariables` | the variables to override |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/parser/CLParsingException` |   |

### parseJSON

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static void parseJSON(String content, Transition transition, int state)
```

Parse and populate a transition

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html content` | JSON string to parse |
| `https://developer.android.com/reference/androidx/constraintlayout/core/state/Transition transition` | The Transition to be populated |
| `int state` |   |

### parseMotionSceneJSON

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static void parseMotionSceneJSON(CoreMotionScene scene, String content)
```

Parse and build a motionScene this should be in a MotionScene / MotionSceneParser