Reg JSON Object

Hi All,

Thanks in advance for the Help.

I am trying to store the a Json String ex: "{"a":null,"b":2}" into a column in MySQL of type JSON.

but when i call a rule which returns the json string and pass it to the write to data store entity , it is failing to store JSON string saying "invalid JSON text"as the 

input is getting changed to [a:,b:2] without the quotes. 

Could you please suggest how to preserve the quotes in transfer and storing the value?

appreciate your help.

Thanks
Raj 

  Discussion posts and replies are publicly visible

Parents
  • Hi Raj - 

    I also had some  difficulty performing this save in process.
    Have you opened a ticket with Appian support for this?
    Perhaps you should and let us know here what the solution is.

    Note:
    I was able to complete the write to data store from SAIL though.
    You just need to format the text very carefully.

    See the following example.

    a!writeToDataStoreEntity(
      cons!json_table_DSE,
      'type!{urn:com:appian:types}json_table'(
        id:3, 
        jsoncol:"{"&chr(34)&"a"&chr(34)&":null,"&chr(34)&"b"&chr(34)&":2}"
      )
    )
    
    OR
    
    a!writeToDataStoreEntity(
      cons!json_table_DSE,
      'type!{urn:com:appian:types}json_table'(
        id:3, 
        jsoncol: a!toJson({"a":null,"b":2})
      )
    )


    Finally, I'm not sure about your use case, but, if you do get the solution for process, keep in mind that this approach could arguably increase the size of your process variables, and thus increase the footprint of each of these processes.
    Another solid approach could be to store the variables in the DB individually and to later construct the JSON when it's actually needed.

  • Hi Robert ,
    Good Day!.
    Thanks for the suggestion and it helped me :-)
    Thanks again
    Raj
Reply Children