I'm a newbiew in java language.
I want to get a value from a JsonObject
and convert it to BigDecimal
.
I have the following code:
JsonReader jsonReader;
try {
jsonReader = Json.createReader(httpRequest.getReader());
} catch (IOException e) {
return Response.serverError().entity("Problem reading json body").build();
}
JsonObject jsonObj = jsonReader.readObject();
Map<String, Object> paramMap = UtilMisc.toMap("productId", productId, "internalName",
jsonObj.getString("internalName"), "productName", jsonObj.getString("productName"), "productTypeId",
jsonObj.getString("productTypeId"), "login.username", username, "login.password", password,
"description", jsonObj.getString("description"), "longDescription", jsonObj.getString("longDescription"),
"productHeight", (BigDecimal)jsonObj.get("productHeight"));
What I want is to do something similar to (BigDecimal)jsonObj.get("productHeight")
.
Thank you.