JSON To Bean Definition
I am trying to map a PayPal API JSON response to a Java Bean. I used a
tool called http://www.jsonschema2pojo.org/ in order to create the object.
Has it done it correctly, based on the following JSON? It created 5
different objects.
DoReferenceTransactionResponseDetails.java
FeeAmount.java
GrossAmount.java
PaymentInfo.java
TaxAmount.java
I guess I need to include those in a base object called something like
RefTransactionResponse that includes Timestamp, ack, etc? Is the only
other way to do this is using inner classes?
{ "doReferenceTransactionResponseDetails":{
"billingAgreementID":"B-92T23517L08326025",
"paymentInfo":{
"transactionID":"4U482182NY9710827",
"transactionType":"MERCHTPMT",
"paymentType":"INSTANT",
"paymentDate":"2013-09-05T14:36:35Z",
"grossAmount":{
"currencyID":"USD",
"value":"14.99"
},
"feeAmount":{
"currencyID":"USD",
"value":"0.73"
},
"taxAmount":{
"currencyID":"USD",
"value":"0.00"
},
"paymentStatus":"COMPLETED",
"pendingReason":"NONE",
"reasonCode":"NONE",
"protectionEligibility":"Ineligible",
"protectionEligibilityType":"None"
}
},
"timestamp":"2013-09-05T14:36:36Z",
"ack":"SUCCESS",
"correlationID":"11b0602aa6328",
"errors":[
],
"version":"106.0",
"build":"7560199"
}
No comments:
Post a Comment