How to Split Recursive Parse

I have a question, when i have something like this

Card 1",“card_no”:“6006491614094856494”,“pin”:“2179”
Card 2",“card_no”:“6006491614094856495”,“pin”:“2180”

when i put Card_no and Card Pin in recursive, in the Utility Append Lines appear like this

Save.txt ()

(
[6006491614094856494, 6006491614094856495]:[2179, 2180]
)

i want to show it like this

6006491614094856494:2179
6006491614094856495:2180

how can i do that?

Original Response:

card_name":“Card 1”,“card_no”:“6006491614094856494”,“pin”:“2179”,{“card_name”:“Card 2”,“card_no”:“6006491614094201055”,“pin”:“2732

I have Two different Captures (Same Parse [Card and Pin])

i need to separate them

Send the lolicode what are you using

Try this, test5.txt file (card_name »:« Card 1 »,« card_no »:« 6006491614094856494 »,« pin »:« 2179 », {« card_name »:« Card 2 »,« card_no »:« 6006491614094201055 »,« pin »:« 2732 »)

BLOCK:FileRead
  path = "UserData/test/test5.txt"
  => CAP @fileReadOutput
ENDBLOCK

BLOCK:Parse
LABEL:Parse_Card
  input = $"<fileReadOutput>"
  leftDelim = "« card_no »:« "
  rightDelim = " »"
  RECURSIVE
  MODE:LR
  => VAR @Parse_Card
ENDBLOCK

BLOCK:Parse
LABEL:Parse_Pin
  input = $"<fileReadOutput>"
  leftDelim = "« pin »:« "
  rightDelim = " »"
  RECURSIVE
  MODE:LR
  => VAR @Parse_Pin
ENDBLOCK

BLOCK:ZipLists
  list1 = @Parse_Card
  list2 = @Parse_Pin
  format = "[0]:[1]"
  => VAR @zipListsOutput
ENDBLOCK

BLOCK:FileAppendLines
  path = "UserData/test/Card_Pin.txt"
  lines = @zipListsOutput
ENDBLOCK

what is the original full JSON you are getting these card numbers, send me the whole source buddy we can solve this from Jtoken or regex directly. send the full json source

If this is the source then we can directly use regex to format them for our use, here have a look you need not do anything else fo rthat

here’s the lolicode for the block

  input = @data.SOURCE

  pattern = "“Card [0-9]+”,“card_no”:“(.*?)”,“pin”:“(.*?)”"

  outputFormat = "[1]:[2]"

  RECURSIVE

  MODE:Regex

  => CAP @cards

ENDBLOCK

and if you want to save the cards use this

BLOCK:ConstantString

  value = "card_name\":“Card 1”,“card_no”:“6006491614094856494”,“pin”:“2179”,{“card_name”:“Card 2”,“card_no”:“6006491614094201055”,“pin”:“2732”"

  => VAR @data.SOURCE

ENDBLOCK

BLOCK:Parse

  input = @data.SOURCE

  pattern = "“Card [0-9]+”,“card_no”:“(.*?)”,“pin”:“(.*?)”"

  outputFormat = "[1]:[2]"

  RECURSIVE

  MODE:Regex

  => CAP @cards

ENDBLOCK

BLOCK:FileAppendLines

  path = "UserData\\cards\\cards.txt"

  lines = @cards

ENDBLOCK

Leave a :heart: if it works

1 Like