How to use the split() function in an action that processes a JSON object

Timothy Stevens 0 Reputation points
2025-03-08T22:36:12.4866667+00:00

I have a JSON object that contains a property named "Born At" the property contains city, state as data. I am trying to use the split() function in an action to return just the city and not the state. I am not able to figure out how to do so. I've tried split((body.Born At but I'm not sure what the complete syntax is. can't seem to figure out the entire syntax for manipulating data in the body of the JSON object.

Thanks for any help provided!

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,388 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Marcin Policht 38,470 Reputation points MVP
    2025-03-08T23:15:21.6033333+00:00

    The exact syntax depends on how your data is structured. Assuming your JSON looks like this:

    {
      "Born At": "New York, NY"
    }
    

    you should be able to use the following expression:

    split(triggerBody()?['Born At'], ',')[0]
    

    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.