Forum Discussion

pulipati's avatar
pulipati
New Contributor
8 years ago

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
}]
}

3 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Question seems to be incomplete and not clear what you want to do with it?
  • New2API's avatar
    New2API
    Frequent Contributor

    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.

     

    https://siking.wordpress.com/2013/07/05/dynamically-create-elements-in-a-soapui-request-json-version/

     

    Good luck!