How to create Json Parameter based on CDT of Array?

Certified Associate Developer

Hello All,

I'm having some difficulty for creating Json parameter based on my cdt. Here is the scenario,

 

Suppose my CDT is as below

[ID:12,Identifier:"Abc",Label:"NumberOfPages",Value:"30"],

[ID:13,Identifier:"Pqr",Label:"LastModified",Value:"2018-12-11"]

 

Now I need to create a Json parameter in such a way that it consists of label and value as a actual parameter and its value i.e. Json output should be something like

{"NumberOfPages":"30",LastModified":"2018-12-11"}

 

Any suggestion here would be appreciated. Thanks in advance

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to viveku3486

    Can you post an example of the code you're using?  The result you describe getting from a!toJson is not consistent with how I have seen it works when passed an actual CDT.

    For example, this expression:

    load(
      local!myCdt: {
        ID: 12,
        Identifier: "Abc",
        NumberOfPages: 30,
        LastModified: today()
      },
      
      a!toJson(local!myCdt)
    )

     

    produces the following output, which seems consistent with what you seem to be asking for:

    {"ID":12,"Identifier":"Abc","NumberOfPages":30,"LastModified":"2018-06-29Z"}
Children