public <T> T getObject(String path, Class<T> objectType) {
    """
	Get the result of a Object path expression as a java Object.
	E.g. given the following Object document:
	<pre>
	{ "store": {
	"book": [
	{ "category": "reference",
	"author": "Nigel Rees",
	"title": "Sayings of the Century",
	"price": 8.95
	},
	{ "category": "fiction",
	"author": "Evelyn Waugh",
	"title": "Sword of Honour",
	"price": 12.99
	},
	{ "category": "fiction",
	"author": "Herman Melville",
	"title": "Moby Dick",
	"isbn": "0-553-21311-3",
	"price": 8.99
	},
	{ "category": "fiction",
	"author": "J. R. R. Tolkien",
	"title": "The Lord of the Rings",
	"isbn": "0-395-19395-8",
	"price": 22.99
	}
	],
	"bicycle": {
	"color": "red",
	"price": 19.95
	}
	}
	}
	</pre>
	And a Java object like this:
	<p/>
	<pre>
	public class Book {
	private String category;
	private String author;
	private String title;
	private String isbn;
	private float price;
	
	public String getCategory() {
	return category;
	}
	
	public void setCategory(String category) {
	this.category = category;
	}
	
	public String getAuthor() {
	return author;
	}
	
	public void setAuthor(String author) {
	this.author = author;
	}
	
	public String getTitle() {
	return title;
	}
	
	public void setTitle(String title) {
	this.title = title;
	}
	
	public String getIsbn() {
	return isbn;
	}
	
	public void setIsbn(String isbn) {
	this.isbn = isbn;
	}
	
	public float getPrice() {
	return price;
	}
	
	public void setPrice(float price) {
	this.price = price;
	}
	}
	</pre>
	<p/>
	Then
	<pre>
	Book book = from(Object).getObject("store.book[2]", Book.class);
	</pre>
	<p/>
	maps the second book to a Book instance.
	
	@param path       The path to the object to map
	@param objectType The class type of the expected object
	@param <T>        The type of the expected object
	@return The object
    """
        Object object = getJsonObject(path);
        if (object == null) {
            return null;
        } else if (object instanceof List || object instanceof Map) {
            // TODO Avoid double parsing
            object = objectToString(object);
        } else {
            return ObjectConverter.convertObjectTo(object, objectType);
        }

        if (!(object instanceof String)) {
            throw new IllegalStateException("Internal error: Json object was not an instance of String, please report to the REST Assured mailing-list.");
        }

        return (T) jsonStringToObject((String) object, objectType);
    }
public <T> T getObject(String path, Class<T> objectType) {
        Object object = getJsonObject(path);
        if (object == null) {
            return null;
        } else if (object instanceof List || object instanceof Map) {
            // TODO Avoid double parsing
            object = objectToString(object);
        } else {
            return ObjectConverter.convertObjectTo(object, objectType);
        }

        if (!(object instanceof String)) {
            throw new IllegalStateException("Internal error: Json object was not an instance of String, please report to the REST Assured mailing-list.");
        }

        return (T) jsonStringToObject((String) object, objectType);
    }
public < T > T getObject ( String path , Class < T > objectType ) { Object object = getJsonObject ( path ) ; if ( object == null ) { return null ; } else if ( object instanceof List || object instanceof Map ) { // TODO Avoid double parsing object = objectToString ( object ) ; } else { return ObjectConverter . convertObjectTo ( object , objectType ) ; } if ( ! ( object instanceof String ) ) { throw new IllegalStateException ( "Internal error: Json object was not an instance of String, please report to the REST Assured mailing-list." ) ; } return ( T ) jsonStringToObject ( ( String ) object , objectType ) ; }
Get the result of a Object path expression as a java Object.
E.g. given the following Object document:
<pre>
{ "store": {
"book": [
{ "category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{ "category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
{ "category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{ "category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}
</pre>
And a Java object like this:
<p/>
<pre>
public class Book {
private String category;
private String author;
private String title;
private String isbn;
private float price;

public String getCategory() {
return category;
}

public void setCategory(String category) {
this.category = category;
}

public String getAuthor() {
return author;
}

public void setAuthor(String author) {
this.author = author;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public String getIsbn() {
return isbn;
}

public void setIsbn(String isbn) {
this.isbn = isbn;
}

public float getPrice() {
return price;
}

public void setPrice(float price) {
this.price = price;
}
}
</pre>
<p/>
Then
<pre>
Book book = from(Object).getObject("store.book[2]", Book.class);
</pre>
<p/>
maps the second book to a Book instance.

@param path       The path to the object to map
@param objectType The class type of the expected object
@param <T>        The type of the expected object
@return The object
Get the result of a Object path expression as a java Object . E . g . given the following Object document : <pre > { store : { book : [ { category : reference author : Nigel Rees title : Sayings of the Century price : 8 . 95 } { category : fiction author : Evelyn Waugh title : Sword of Honour price : 12 . 99 } { category : fiction author : Herman Melville title : Moby Dick isbn : 0 - 553 - 21311 - 3 price : 8 . 99 } { category : fiction author : J . R . R . Tolkien title : The Lord of the Rings isbn : 0 - 395 - 19395 - 8 price : 22 . 99 } ] bicycle : { color : red price : 19 . 95 } } } < / pre > And a Java object like this : <p / > <pre > public class Book { private String category ; private String author ; private String title ; private String isbn ; private float price ;