Nested Json

I need to make a webservice call with nested jsons in the parameters. Has anyone successfully done it? I tried using a!toJson within another a!toJson with no success.

 

 a!toJson( {"name":"Document C", "type": a!toJson({"fields": a!toJson({"name":"Bob","type":"identification", "subtype":"FULLNAME"}), "role":"user", "id":"xxx"}), "id":"xxxxx", "extract":true})

result:

"{"name":"Document C","type":"{\"fields\":\"{\\\"name\\\":\\\"Bob\\\",\\\"type\\\":\\\"identification\\\",\\\"subtype\\\":\\\"FULLNAME\\\"}\",\"role\":\"user\",\"id\":\"xxx\"}","id":"xxxxx","extract":true}"

The "\"s are showstoppers. 

  Discussion posts and replies are publicly visible

Parents
  • 	
    	
    {"name":"Document C","type":{"fields":{"name":"Bob","type":"identification","subtype":"FULLNAME"},"role":"user","id":"xxx"},"id":"xxxxx","extract":true}
    I think what you want is to take out all those nested toJson like this 

     

    a!toJson(
      {
        "name": "Document C",
        "type": 
          {
            "fields":
              {
                "name": "Bob",
                "type": "identification",
                "subtype": "FULLNAME"
              }
            ,
            "role": "user",
            "id": "xxx"
          }
        ,
        "id": "xxxxx",
        "extract": true
      }
    )

    the result will be this :

    	
    "{"name":"Document C","type":{"fields":{"name":"Bob","type":"identification","subtype":"FULLNAME"},"role":"user","id":"xxx"},"id":"xxxxx","extract":true}"

     

    In case you have tried this without success please let me know more about the scenario

     

    Best regards 

    Jose Perez

Reply
  • 	
    	
    {"name":"Document C","type":{"fields":{"name":"Bob","type":"identification","subtype":"FULLNAME"},"role":"user","id":"xxx"},"id":"xxxxx","extract":true}
    I think what you want is to take out all those nested toJson like this 

     

    a!toJson(
      {
        "name": "Document C",
        "type": 
          {
            "fields":
              {
                "name": "Bob",
                "type": "identification",
                "subtype": "FULLNAME"
              }
            ,
            "role": "user",
            "id": "xxx"
          }
        ,
        "id": "xxxxx",
        "extract": true
      }
    )

    the result will be this :

    	
    "{"name":"Document C","type":{"fields":{"name":"Bob","type":"identification","subtype":"FULLNAME"},"role":"user","id":"xxx"},"id":"xxxxx","extract":true}"

     

    In case you have tried this without success please let me know more about the scenario

     

    Best regards 

    Jose Perez

Children