This command will return split a string at the delimiter and return it as a JSON array.
string splitn '|' 'one|two|three' 2
Would return ["one","two|three"]
NOTE: To read content from standard input we use the -i -
option.
echo 'one|two|three' | string -i - splitn '|' 2
Would return ["one","two|three"]