Package org.springframework.test.json

# Class JsonContent

java.lang.Object
org.springframework.test.json.JsonContent

All Implemented Interfaces:
  `org.assertj.core.api.AssertProvider<JsonContentAssert>`

public final class JsonContent extends Object implements org.assertj.core.api.AssertProvider<JsonContentAssert>
JSON content which is generally used to `provide` `JsonContentAssert` to AssertJ `assertThat` calls.

Since:
  6.2
Author:
  Phillip Webb, Diego Berrueta

## Constructor Summary

Constructors
Constructor
Description
`JsonContent(String json)`
Create a new `JsonContent` instance.
`JsonContent(String json, HttpMessageContentConverter contentConverter)`
Create a new `JsonContent` instance with the message converter to use to deserialize content.

## Method Summary

Modifier and Type
Method
Description
`JsonContentAssert`
`assertThat()`
Use AssertJ's `assertThat` instead.
`String`
`getJson()`
Return the actual JSON content string.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### JsonContent

public JsonContent(String json, @Nullable HttpMessageContentConverter contentConverter)
Create a new `JsonContent` instance with the message converter to use to deserialize content.

Parameters:
  `json` - the actual JSON content
  `contentConverter` - the content converter to use

### JsonContent

public JsonContent(String json)
Create a new `JsonContent` instance.

Parameters:
  `json` - the actual JSON content

## Method Details

### assertThat

public JsonContentAssert assertThat()
Use AssertJ's `assertThat` instead.

Specified by:
  `assertThat` in interface `org.assertj.core.api.AssertProvider<JsonContentAssert>`

### getJson

public String getJson()
Return the actual JSON content string.

### toString

public String toString()

Overrides:
  `toString` in class `Object`