Restlet parsing json request

Restlet parsing json request

I am trying to make a simple observatory app for books and stuff using restlet. Currently, I've managed some simple GETs here and there but i have a problem with POST.

I am trying to make a simple observatory app for books and stuff using restlet. Currently, I've managed some simple GETs here and there but i have a problem with POST.

To be precise, I can't access the entity's body. Here is the sample request, through Postman

{
    "isbn": "12345678909876",
    "title": "test",
    "genre": "Encyclopedias",
    "publisher": "Tzoman",
    "release": "2011-01-01",
    "language": "Foreign",
    "pages": 666,
    "cover": "Hard",
    "withdrawn": true,
    "tags": "sapiente"
}

And here is the code:

@Override
protected Representation post(Representation entity) throws ResourceException {

if (entity.getMediaType().isCompatible(MediaType.APPLICATION_JSON)) {
    //Create a new restlet form
    Form form = new Form(entity);
    System.out.println("Form start");
    System.out.println(form);
    System.out.println(form.getClass().getSimpleName());
    System.out.println("Form end");

    //Read the parameters
    String isbn = form.getFirstValue("isbn");
    System.out.println(isbn);

    try {
        System.out.println("The entity:" + entity);
        JSONObject json = new JSONObject(entity);
        String isbn2 = json.getString("isbn");
        System.out.println(isbn2);
    } catch (JSONException e){
        e.printStackTrace();
    }
}

The output is varied: Using the first approach, I've managed to somewhat access the request with the following output:

[[
{
    <Object here>
}=null
]]

The second approach aims to parse the request as a JSON Object but the reply i get is [application/json].

I have configured Postman to send json in headers and after an exhausting amount of research, I'm stuck. If anyone can provide me with some hints or research material, I would be indebted!

Thanks for your time!

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Introduction to JSON - Java

Learn the fundamentals of parsing and manipulating JSON data with the JSON-Java library.

How to Convert a Java Object into a JSON String

In this article, you'll learn how to convert a Java Object into a JSON String

Converting JSON to CSV in Java

In this tutorial, we’ll see how to use Jackson to convert JSON into CSV and vice versa.