Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Who agreed with this solution

avatar
Master Guru

The following configuration of ReplaceText should work for you:

16496-replacetext-1-element-array.png

where the Search Value is the following:

[\[\]](\{|\})

This matches [{ or ]} (and also [} and ]{ which shouldn't show up if your input is valid JSON) and replaces it with whichever curly brace it found. Note that this is a fairly specific solution, where the array is the last element of an object (i.e. the end pattern is not the end-of-object followed by end-of-array, rather the reverse).

A more forgiving solution (for your input JSON) might be to use the following Chain spec in a JoltTransformJSON processor:

[
  {
    "operation": "shift",
    "spec": {
      "result": {
        "curves": {
          "*": {
            "@": "result.curves"
          }
        },
        "*": "result.&"
      },
      "*": "&"
    }
  }
]

This "hoists" the object in the 1-element array up one level, achieving the same result as the ReplaceText pattern above.

View solution in original post

Who agreed with this solution