Re: Building json using JsonOutput
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Building json using JsonOutput
I am able to build json for single dimensional array but having issues in building multidimensional array.
Can anyone please help me in building JSON using JSONBuilder for the below Json format.
{
"hid": 5000607,
"eid": "mpuli243",
"lud": 1488299449000,
"ats": [{
"ac": ["CCLA0004"],
"lud": 1488296135092,
"prem": "Y",
"pr": [{
"isDefaultBoolean": true,
"a": 11.0,
"pid": 1,
"ct": 1488299449000,
"lud": 1488299449000,
"d": "Y",
"s": [{
"sd": 1488171600000,
"ed": 253402232400000,
"DOW": ["SU",
"MO",
"TU",
"WE",
"TH",
"SA"],
"lud": 1488299449000
}]
}
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello there! please correct me if I am wrong.
I think, according to you one dimensional JSON is something like this:
{
"ID": 1,
"Type": Books,
"Qty":300
}
where you do not have subset inside JSON array. And multidimensional is the one you mentioned in your question. I am not sure how you are going to get base template or sub-level json.
I did build my JSON using jsonbuilder. But for main and sub-level JSON, I was getting data from two different Get methods and then I used 'Map' to modify or add sub-level to main JSON response.
in your ex: ats is a map, ac is a map, pr is a map.
please refer to below link. It might shed some light to your problems.
Good luck!
