I am trying to parse to JSON object in java. I am posting json key value object using dojo.xhrPost()
method as shown below:
dojo.xhrPost({
url: /esturl/,
handleAs : "text",
content : {INST1 : {"0001" : "aa"},
INST2 : {"0002" : "bb"},
INST3 : {"0003" : "cc"}},
load : load(data),
error : error
});
Now I am reading this post data from request context:
Map<String, String[]> paramMap = requestContext.getParameterMap();
when I am printing this in loop:
Iterator it = paramMap.entrySet().iterator();
while(it.hasnext()){
Map.entry pairs = (Map.Entry) it.next();
System.out.println(pairs.getKey());
System.out.println(pairs.getkValue());
}
this returns me :
INST1
[Ljava.lang.String;@1b4cef
INST2
[Ljava.lang.String;@5801d
like wise, but I should be getting values like
INST1 : {"0001" : "aa"}, INST2 : {"0002" : "bb"}, INST3 : {"0003" : "cc"}},
any guidance would be highly appreciated.
Update
When I try to get value of one parameter using
String[] X = requestContext.getParameters{"INST1"};
if (X != null){
System.out.println(X.length);
System.out.println(X[0]);
System.out.println(X[0].length);
}
then am getting :
1
[object Object]
[object Object]
Q Now how can I get actual values of Object like INST1 : {"0001" : "aa"}
instead of [object Object] ?