I am trying to read object and convert into string. But the root element is getting changed from payment_token
to PaymentToken
.
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
String requestString = mapper.writeValueAsString(paymentToken); //paymenttoken is valid object
Input Object:
{
"payment_token": {
"client_id": "test",
"currency_code": "USD"
}
}
Getting Output as:
{
"PaymentToken": {
"client_id": "test",
"currency_code": "USD"
}
}
Help me to get the root object as it is in input ?