[{"data":1,"prerenderedAt":439},["ShallowReactive",2],{"node-red-\u002Fnode-red\u002Fcore-nodes\u002Fsplit":3},{"id":4,"title":5,"body":6,"description":17,"extension":432,"meta":433,"navigation":434,"path":435,"seo":436,"stem":437,"__hash__":438},"nodeRed\u002Fnode-red\u002Fcore-nodes\u002Fsplit.md","Node-RED - Split Node",{"type":7,"value":8,"toc":406},"minimark",[9,14,18,23,26,30,38,43,50,54,57,61,71,75,82,85,135,139,142,149,153,157,164,169,173,180,201,204,208,214,217,220,224,231,234,238,245,248,251,255],[10,11,13],"h1",{"id":12},"split","Split",[15,16,17],"p",{},"Splits a message into a sequence of messages.",[19,20,22],"h2",{"id":21},"where-and-why-do-we-use-the-split-node","Where and why do we use the Split node?",[15,24,25],{},"The Split node breaks one message into multiple messages. This is essential when you receive bulk data that needs individual processing. For example, a SQL query might return hundreds of rows, or an API might send multiple sensor readings in one payload. The Split node turns that single message into a stream of messages you can process one at a time.",[19,27,29],{"id":28},"modes-of-operation","Modes of operation",[15,31,32,33,37],{},"The Split node's behavior depends on what type of data is in ",[34,35,36],"code",{},"msg.payload",":",[39,40,42],"h3",{"id":41},"stringbuffer","String\u002FBuffer",[15,44,45,46,49],{},"Splits on a specified character (default is ",[34,47,48],{},"\\n"," for newlines), a buffer sequence, or into fixed lengths. You can use spaces for words, commas for CSV data, or any character. Also supports multi-character strings and buffer sequences.",[39,51,53],{"id":52},"array","Array",[15,55,56],{},"Splits into individual array elements, or into arrays of a fixed length. Useful when APIs have batch size limits and you need to chunk data into smaller groups.",[39,58,60],{"id":59},"object","Object",[15,62,63,64,67,68,70],{},"Sends one message for each key-value pair. By default, the key name goes into ",[34,65,66],{},"msg.topic"," and the value goes into ",[34,69,36],{},".",[19,72,74],{"id":73},"how-the-node-handles-messages","How the node handles messages",[15,76,77,78,81],{},"Each output message gets a ",[34,79,80],{},"msg.parts"," property with information about how it was split from the original. This lets the Join node reassemble the sequence back into a single message.",[15,83,84],{},"The property contains:",[86,87,88,96,102,108,114,120,129],"ul",{},[89,90,91,95],"li",{},[92,93,94],"strong",{},"id"," - identifier for the message group",[89,97,98,101],{},[92,99,100],{},"index"," - position within the group",[89,103,104,107],{},[92,105,106],{},"count"," - total messages in the group (not set in streaming mode since the total is unknown)",[89,109,110,113],{},[92,111,112],{},"type"," - the original data type (string, array, object, or buffer)",[89,115,116,119],{},[92,117,118],{},"ch"," - for strings or buffers, the delimiter used to split the message",[89,121,122,125,126,128],{},[92,123,124],{},"key"," - for objects, the key name this message came from (also copied to ",[34,127,66],{}," by default)",[89,130,131,134],{},[92,132,133],{},"len"," - when using fixed length splitting, the length of each segment",[39,136,138],{"id":137},"streaming-mode","Streaming mode",[15,140,141],{},"In streaming mode, the node processes incomplete data across multiple messages. Say a serial device sends newline-terminated commands but a message ends mid-command. The node splits and sends the complete parts, then holds the incomplete part and prepends it to the next message that arrives.",[15,143,144,145,148],{},"Because streaming mode doesn't know how many messages to expect, it doesn't set ",[34,146,147],{},"msg.parts.count",". This means you can't use it with the Join node in automatic mode, since Join needs to know when the sequence is complete.",[19,150,152],{"id":151},"examples","Examples",[39,154,156],{"id":155},"splitting-arrays","Splitting arrays",[15,158,159,160,163],{},"Arrays are the simplest case. Feed in an array and get one message per element. Here an array ",[34,161,162],{},"[1, 2, 3, 4]"," becomes four messages.",[165,166],"render-flow",{":height":167,"flow":168},"200","W3siaWQiOiI2MzU0ZGFhY2NmMmIyNTA0IiwidHlwZSI6ImluamVjdCIsInoiOiIyODYyYmY1YzI3OGZmNWJkIiwibmFtZSI6IiIsInByb3BzIjpbeyJwIjoicGF5bG9hZCJ9XSwicmVwZWF0IjoiIiwiY3JvbnRhYiI6IiIsIm9uY2UiOmZhbHNlLCJvbmNlRGVsYXkiOjAuMSwidG9waWMiOiIiLCJwYXlsb2FkIjoiWzEsIDIsIDMsIDRdIiwicGF5bG9hZFR5cGUiOiJqc29uIiwieCI6MTQwLCJ5IjoxMDAsIndpcmVzIjpbWyI4MmFiNTJjN2Y4OTRmNzI1Il1dfSx7ImlkIjoiODJhYjUyYzdmODk0ZjcyNSIsInR5cGUiOiJzcGxpdCIsInoiOiIyODYyYmY1YzI3OGZmNWJkIiwibmFtZSI6IlNwbGl0IEFycmF5Iiwic3BsdCI6IlxcbiIsInNwbHRUeXBlIjoic3RyIiwiYXJyYXlTcGx0IjoxLCJhcnJheVNwbHRUeXBlIjoibGVuIiwic3RyZWFtIjpmYWxzZSwiYWRkbmFtZSI6IiIsIngiOjMxMCwieSI6MTAwLCJ3aXJlcyI6W1siODBlZTc5Yjc1ZTM3M2JhOSJdXX0seyJpZCI6IjgwZWU3OWI3NWUzNzNiYTkiLCJ0eXBlIjoiZGVidWciLCJ6IjoiMjg2MmJmNWMyNzhmZjViZCIsIm5hbWUiOiJQcmludCBpbmRpdmlkdWFsIHZhbHVlcyIsImFjdGl2ZSI6dHJ1ZSwidG9zaWRlYmFyIjp0cnVlLCJjb25zb2xlIjpmYWxzZSwidG9zdGF0dXMiOmZhbHNlLCJjb21wbGV0ZSI6InBheWxvYWQiLCJ0YXJnZXRUeXBlIjoibXNnIiwic3RhdHVzVmFsIjoiIiwic3RhdHVzVHlwZSI6ImF1dG8iLCJ4Ijo1MjAsInkiOjEwMCwid2lyZXMiOltdfV0=",[39,170,172],{"id":171},"regrouping-elements","Regrouping elements",[15,174,175,176,179],{},"Sometimes you need to chunk data into smaller groups. Say an API only accepts 20 records at a time but you have 100. Set ",[34,177,178],{},"Fixed length of"," to split the array into chunks of that size.",[15,181,182,183,186,187,189,190,193,194,197,198,70],{},"With input ",[34,184,185],{},"[1, 2, 3, 4, 5]"," and ",[34,188,178],{}," set to 2, you get three messages: ",[34,191,192],{},"[1, 2]",", ",[34,195,196],{},"[3, 4]",", and ",[34,199,200],{},"[5]",[165,202],{":height":167,"flow":203},"W3siaWQiOiI1NzA4N2M4MDI5ZDQ0ZmEyIiwidHlwZSI6ImluamVjdCIsInoiOiIyODYyYmY1YzI3OGZmNWJkIiwibmFtZSI6IiIsInByb3BzIjpbeyJwIjoicGF5bG9hZCJ9XSwicmVwZWF0IjoiIiwiY3JvbnRhYiI6IiIsIm9uY2UiOmZhbHNlLCJvbmNlRGVsYXkiOjAuMSwidG9waWMiOiIiLCJwYXlsb2FkIjoiWzEsIDIsIDMsIDQsIDVdIiwicGF5bG9hZFR5cGUiOiJqc29uIiwieCI6MTUwLCJ5IjoxNjAsIndpcmVzIjpbWyJiOGQwYWVjN2YwY2JhNmM1Il1dfSx7ImlkIjoiYjhkMGFlYzdmMGNiYTZjNSIsInR5cGUiOiJzcGxpdCIsInoiOiIyODYyYmY1YzI3OGZmNWJkIiwibmFtZSI6IlJlZ3JvdXAgYXJyYXkiLCJzcGx0IjoiXFxuIiwic3BsdFR5cGUiOiJzdHIiLCJhcnJheVNwbHQiOiIyIiwiYXJyYXlTcGx0VHlwZSI6ImxlbiIsInN0cmVhbSI6ZmFsc2UsImFkZG5hbWUiOiIiLCJ4IjozNDAsInkiOjE2MCwid2lyZXMiOltbImQ0NWQ2OThiYWU4YjU3NWQiXV19LHsiaWQiOiJkNDVkNjk4YmFlOGI1NzVkIiwidHlwZSI6ImRlYnVnIiwieiI6IjI4NjJiZjVjMjc4ZmY1YmQiLCJuYW1lIjoiUHJpbnQgaW5kaXZpZHVhbCB2YWx1ZXMiLCJhY3RpdmUiOnRydWUsInRvc2lkZWJhciI6dHJ1ZSwiY29uc29sZSI6ZmFsc2UsInRvc3RhdHVzIjpmYWxzZSwiY29tcGxldGUiOiJwYXlsb2FkIiwidGFyZ2V0VHlwZSI6Im1zZyIsInN0YXR1c1ZhbCI6IiIsInN0YXR1c1R5cGUiOiJhdXRvIiwieCI6NTYwLCJ5IjoxNjAsIndpcmVzIjpbXX1d",[39,205,207],{"id":206},"splitting-strings","Splitting strings",[15,209,210,211,213],{},"The default string split uses ",[34,212,48],{}," (newline) as the delimiter, which splits text by line. This works for processing logs, CSV data, or any line-based format.",[15,215,216],{},"Here we split a list of European cities, one per line.",[165,218],{":height":167,"flow":219},"W3siaWQiO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FR5cGUiOiJtc2ciLCJmb3JtYXQiOiJoYW5kbGViYXJzIiwic3ludGF4IjoibXVzdGFjaGUiLCJ0ZW1wbGF0ZSI6IkFtc3RlcmRhbVxuQW5kb3JyYSBsYSBWZWxsYVxuQXRoZW5zIiwib3V0cHV0Ijoic3RyIiwieCI6MjkwLCJ5IjoyMjAsIndpcmVzIjpbWyI0YjU2YTNlZDgzMWRmNTllIl1dfV0=",[39,221,223],{"id":222},"splitting-by-word","Splitting by word",[15,225,226,227,230],{},"Change the delimiter to a space and you can split sentences into words. Put a space character in the ",[34,228,229],{},"Split using"," field. It won't be visible in the form but it's there.",[165,232],{":height":167,"flow":233},"W3siaWQiOiI2MTkyMDlkNmUzZjAyNDczIiwidHlwZSI6ImluamVjdCIsInoiOiIyODYyYmY1YzI3OGZmNWJkIiwibmFtZSI6IiIsInByb3BzIjpbeyJwIjoicGF5bG9hZCJ9XSwicmVwZWF0IjoiIiwiY3JvbnRhYiI6IiIsIm9uY2UiOmZhbHNlLCJvbmNlRGVsYXkiOjAuMSwidG9waWMiOiIiLCJwYXlsb2FkIjoiZm9vIGJhciIsInBheWxvYWRUeXBlIjoic3RyIiwieCI6MTMwLCJ5IjoyODAsIndpcmVzIjpbWyIxNWI5YjNkMTdhNjRlMmM3Il1dfSx7ImlkIjoiMTViOWIzZDE3YTY0ZTJjNyIsInR5cGUiOiJzcGxpdCIsInoiOiIyODYyYmY1YzI3OGZmNWJkIiwibmFtZSI6IlNwbGl0IGJ5IHNwYWNlIiwic3BsdCI6IiAiLCJzcGx0VHlwZSI6InN0ciIsImFycmF5U3BsdCI6MSwiYXJyYXlTcGx0VHlwZSI6ImxlbiIsInN0cmVhbSI6ZmFsc2UsImFkZG5hbWUiOiIiLCJ4IjozMDAsInkiOjI4MCwid2lyZXMiOltbIjEyNjA3ZTg3MDhlZjU4ZjIiXV19LHsiaWQiOiIxMjYwN2U4NzA4ZWY1OGYyIiwidHlwZSI6ImRlYnVnIiwieiI6IjI4NjJiZjVjMjc4ZmY1YmQiLCJuYW1lIjoiUHJpbnQgZWFjaCB3b3JkIiwiYWN0aXZlIjp0cnVlLCJ0b3NpZGViYXIiOnRydWUsImNvbnNvbGUiOmZhbHNlLCJ0b3N0YXR1cyI6ZmFsc2UsImNvbXBsZXRlIjoicGF5bG9hZCIsInRhcmdldFR5cGUiOiJtc2ciLCJzdGF0dXNWYWwiOiIiLCJzdGF0dXNUeXBlIjoiYXV0byIsIngiOjUwMCwieSI6MjgwLCJ3aXJlcyI6W119XQ==",[39,235,237],{"id":236},"splitting-objects","Splitting objects",[15,239,240,241,67,243,70],{},"When you split an object, you get one message per key-value pair. The key goes into ",[34,242,66],{},[34,244,36],{},[15,246,247],{},"This example splits a simple object mapping words to numbers.",[165,249],{":height":167,"flow":250},"W3siaWQiOiIzYzRjNTUzNWVjM2IyMTM4IiwidHlwZSI6ImluamVjdCIsInoiOiIyODYyYmY1YzI3OGZmNWJkIiwibmFtZSI6IiIsInByb3BzIjpbeyJwIjoicGF5bG9hZCJ9XSwicmVwZWF0IjoiIiwiY3JvbnRhYiI6IiIsIm9uY2UiOmZhbHNlLCJvbmNlRGVsYXkiOjAuMSwidG9waWMiOiIiLCJwYXlsb2FkIjoie1wib25lXCI6IDEsIFwidHdvXCI6IDJ9IiwicGF5bG9hZFR5cGUiOiJqc29uIiwieCI6MTcwLCJ5IjozNDAsIndpcmVzIjpbWyJlYjMyMjdjOTU0ZGViYjk1Il1dfSx7ImlkIjoiZWIzMjI3Yzk1NGRlYmI5NSIsInR5cGUiOiJzcGxpdCIsInoiOiIyODYyYmY1YzI3OGZmNWJkIiwibmFtZSI6IlNwbGl0IG1hcCIsInNwbHQiOiJcXG4iLCJzcGx0VHlwZSI6InN0ciIsImFycmF5U3BsdCI6IjEiLCJhcnJheVNwbHRUeXBlIjoibGVuIiwic3RyZWFtIjpmYWxzZSwiYWRkbmFtZSI6IiIsIngiOjM2MCwieSI6MzQwLCJ3aXJlcyI6W1siOGM4Mjg3N2NkYWZmOGYwZCJdXX0seyJpZCI6IjhjODI4NzdjZGFmZjhmMGQiLCJ0eXBlIjoiZGVidWciLCJ6IjoiMjg2MmJmNWMyNzhmZjViZCIsIm5hbWUiOiJQcmludCBwcm9wZXJ0eSB2YWx1ZXMiLCJhY3RpdmUiOnRydWUsInRvc2lkZWJhciI6dHJ1ZSwiY29uc29sZSI6ZmFsc2UsInRvc3RhdHVzIjpmYWxzZSwiY29tcGxldGUiOiJwYXlsb2FkIiwidGFyZ2V0VHlwZSI6Im1zZyIsInN0YXR1c1ZhbCI6IiIsInN0YXR1c1R5cGUiOiJhdXRvIiwieCI6NTYwLCJ5IjozNDAsIndpcmVzIjpbXX1d",[19,252,254],{"id":253},"node-documentation","Node Documentation",[256,257,260,262,263,262,267,262,315,262,319,262,374,262,378,262,384,262,390,262,394,262,397],"div",{"className":258},[259],"core-node-doc",[15,261,17],{}," ",[39,264,266],{"id":265},"inputs","Inputs",[268,269,272,282],"dl",{"className":270},[271],"message-properties",[273,274,275,276],"dt",{},"payload",[277,278,281],"span",{"className":279},[280],"property-type","object | string | array | buffer",[283,284,285,286,288,289],"dd",{},"The behaviour of the node is determined by the type of ",[34,287,36],{},":\n",[86,290,291,305,310],{},[89,292,293,297,298,301,302,304],{},[294,295,296],"b",{},"string","\u002F",[294,299,300],{},"buffer"," - the message is split using the specified character (default: ",[34,303,48],{},"), buffer sequence or into fixed lengths.",[89,306,307,309],{},[294,308,52],{}," - the message is split into either individual array elements, or arrays of a fixed-length.",[89,311,312,314],{},[294,313,59],{}," - a message is sent for each key\u002Fvalue pair of the object.",[39,316,318],{"id":317},"outputs","Outputs",[268,320,322,328],{"className":321},[271],[273,323,324,325],{},"parts",[277,326,59],{"className":327},[280],[283,329,330,331,334,335],{},"This property contains information about how the message was split from\nthe original message. If passed to the ",[294,332,333],{},"join"," node, the sequence can be\nreassembled into a single message. The property has the following properties:\n",[86,336,337,342,347,352,357,362,369],{},[89,338,339,341],{},[34,340,94],{}," - an identifier for the group of messages",[89,343,344,346],{},[34,345,100],{}," - the position within the group",[89,348,349,351],{},[34,350,106],{}," - if known, the total number of messages in the group. See 'streaming mode' below.",[89,353,354,356],{},[34,355,112],{}," - the type of message - string\u002Farray\u002Fobject\u002Fbuffer",[89,358,359,361],{},[34,360,118],{}," - for a string or buffer, the data used to the split the message as either the string or an array of bytes",[89,363,364,366,367,70],{},[34,365,124],{}," - for an object, the key of the property this message was created from. The node can be configured to also copy this value to another message properties, such as ",[34,368,66],{},[89,370,371,373],{},[34,372,133],{}," - the length of each message when split using a fixed length value",[39,375,377],{"id":376},"details","Details",[15,379,380,381,383],{},"This node makes it easy to create a flow that performs common actions across\na sequence of messages before, using the ",[294,382,333],{}," node, recombining the\nsequence into a single message.",[15,385,386,387,389],{},"It uses the ",[34,388,80],{}," property to track the individual parts\nof a sequence.",[391,392,138],"h4",{"id":393},"streaming-mode-1",[15,395,396],{},"The node can also be used to reflow a stream of messages. For example, a\nserial device that sends newline-terminated commands may deliver a single message\nwith a partial command at its end. In 'streaming mode', this node will split\na message and send each complete segment. If there is a partial segment at the end,\nthe node will hold on to it and prepend it to the next message that is received.\n",[15,398,399,400,402,403,405],{},"When operating in this mode, the node will not set the ",[34,401,147],{},"\nproperty as it does not know how many messages to expect in the stream. This\nmeans it cannot be used with the ",[294,404,333],{}," node in its automatic mode.",{"title":407,"searchDepth":408,"depth":408,"links":409},"",2,[410,411,417,420,427],{"id":21,"depth":408,"text":22},{"id":28,"depth":408,"text":29,"children":412},[413,415,416],{"id":41,"depth":414,"text":42},3,{"id":52,"depth":414,"text":53},{"id":59,"depth":414,"text":60},{"id":73,"depth":408,"text":74,"children":418},[419],{"id":137,"depth":414,"text":138},{"id":151,"depth":408,"text":152,"children":421},[422,423,424,425,426],{"id":155,"depth":414,"text":156},{"id":171,"depth":414,"text":172},{"id":206,"depth":414,"text":207},{"id":222,"depth":414,"text":223},{"id":236,"depth":414,"text":237},{"id":253,"depth":408,"text":254,"children":428},[429,430,431],{"id":265,"depth":414,"text":266},{"id":317,"depth":414,"text":318},{"id":376,"depth":414,"text":377},"md",{},true,"\u002Fnode-red\u002Fcore-nodes\u002Fsplit",{"title":5,"description":17},"node-red\u002Fcore-nodes\u002Fsplit","Y_d1t-7Tgq8uN-JD7dXhEXyeJA4YNNpUiPq8q6czrmQ",1780070556240]