Announcement

Collapse
No announcement yet.

Format for JSON outbound template with array

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Format for JSON outbound template with array

    Oversimplified:

    The source, a document on disk decimal encoded as follows:

    Code:
    [ 12, 34, 45 ]
    I need to insert this document into a JSON outbound template:

    Code:
    {
    "File": 0       // File: "0" has no effect either 
    }
    But I don't want quotes around the value,

    This is correct:

    Code:
    {
    "File": [ 12, 34, 45 ]  
    }
    This is not correct:

    Code:
    {
    "File": "[ 12, 34, 45 ]"  
    }
    I currently use:

    Code:
    tmp['File'] = connectorMessage.getRawData();
    This does insert double quotes around the value.

    What am I missing?
    Last edited by pacmano; 04-22-2020, 08:37 PM.
    Mirth 3.8.0 / PostgreSQL 11 / Ubuntu 18.04
    Diridium Technologies, Inc.
    https://diridium.com

  • #2
    getRawData() returns the raw content, as a string. And that's exactly what you are getting.

    Comment


    • #3
      Originally posted by Shamil View Post
      getRawData() returns the raw content, as a string. And that's exactly what you are getting.
      Well...that was a hint. The fix:

      Code:
      tmp['File']= JSON.parse(connectorMessage.getRawData());
      Mirth 3.8.0 / PostgreSQL 11 / Ubuntu 18.04
      Diridium Technologies, Inc.
      https://diridium.com

      Comment

      Working...
      X