I'm writing a Java client to a web service and need to parse the response JSON object into a Map<String,String>
.
I don't have control over the JSON format, and the client plugs into a relatively old existing app is a memory hog and has literally hundreds of other java library dependencies.
So my concerns are to make my client as free of external dependencies as possible and have a minimal memory footprint over time to avoid heavy memory usage and garbage collection.
I know I can do this with Gson
or Jackson
so am looking for input as to the best approach considering these runtime constraints (I've never used JSON. Simple and I didn't see on quick perusal how to handle complex types).
The JSON looks like this. I only need to concern myself with the attribute section name/value pairs. The rest I can ignore.
{
"responseInfo": {
"responseMsg": "Success",
"timeStamp": "***",
"transactionId": "***"
},
"callerId": "****",
"locale": "en-US",
"userId": "***",
"attributes":[
{
"attributeName": "AN",
"attributeDescription": "Account Number",
"attributeValue": "*****"
},
{
"attributeName": "EA",
"attributeDescription": "Email Address",
"attributeValue": "****@****"
},
{
"attributeName": "SOI",
"attributeDescription": "someotherinfo",
"attributeValue": "****"
}
}
Thanks for any input!