This is my one json object: JSONObject childDepenObj = new JSONObject();
I am put key and value like that:
childDepenObj.put("COL_CHLD_NULFY", gridObjectArray[86]);
childDepenObj.put("COL_CHLD_MAN", gridObjectArray[87]);
Here I have one more Json Object:
JSONObject gridObject = new JSONObject();
In that I am put above json object as value:
gridObject.put("hiddenObj", childDepenObj);
So, My question is how I get first Json Object key and values in frontend,
I am using like: response.hiddenobj;
then resonse is coming but it coming under hiddenobj, I want direct first json object key and value like: response.COL_CHLD_NULFY;
when I triyng like this it saying undefined, any help?
If I'm understanding you correctly, you can get the value you want by accessing
response.hiddenObj.COL_CHLD_NULFY;
However, if you want to be able to access it like
response.COL_CHLD_NULFY;
then just return the childDepenObj
as the response.
How the current JSON response looks:
{
"hiddenObj": {
"COL_CHLD_NULFY": <<gridObjectArray[86] value>>,
"COL_CHLD_MAN": <<gridObjectArray[87] value>>,
}
}
How you want it to look:
{
"COL_CHLD_NULFY": <<gridObjectArray[86] value>>,
"COL_CHLD_MAN": <<gridObjectArray[87] value>>,
}
JSONObject childDepenObj = new JSONObject();
childDepenObj.put("COL_CHLD_NULFY", gridObjectArray[86]);
childDepenObj.put("COL_CHLD_MAN", gridObjectArray[87]);
JSONObject gridObject = new JSONObject();
gridObject.put("hiddenObj", childDepenObj);
output = response.hiddenobj.COL_CHLD_NULFY
Try this...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.